I have the code to create a pivot table from my data set however I'm not sure how to include the data in the data model (which is an option you see when clicking on "PivotTable" from the Insert Tab.
My goal is to have a Distinct Count of my variable that I'm using in the Values data field.
With PvtTbl.PivotFields("sid")
.Orientation = xlDataField
.Function = xlSum
.NumberFormat = "#,##0"
.Position = 1
I tried replacing "xlSum" with "xlDistinct" but of course that would be too easy haha. Any help would be greatly appreciated.
I am using Excel 2016
Thanks!
My goal is to have a Distinct Count of my variable that I'm using in the Values data field.
With PvtTbl.PivotFields("sid")
.Orientation = xlDataField
.Function = xlSum
.NumberFormat = "#,##0"
.Position = 1
I tried replacing "xlSum" with "xlDistinct" but of course that would be too easy haha. Any help would be greatly appreciated.
I am using Excel 2016
Thanks!