Computing Distinct Count
Calculated fields have an useful feature that enables us to compute complex aggregations. In the last post we calculated the gross margin and also the gross percentage of sales using calculated column and field. Today we would like to determine the number of products in each Color.Let us begin by creating a simple PivotTable showing the SalesAmount by Color of products.
Fig. 1: Sum of SalesAmount by Color of Product |
If we add the ProductKey under the DimProduct table to the PivotTable, we can see that the result is not what we were looking for.
Fig. 2: PivotTable with Sum of ProductKey |
Fig. 3: Value Field Settings Button |
Fig. 4: Value Field Settings- Distinct Count Option |
Fig. 5: PivotTable with Corrected Distinct Count |
Fig. 6: PivotTable with Proper Distinct Count |
Note on Refreshing the Data Model:
We have seen in P2.1 that we can add data to the data model in PowerPivot without going through Excel. Data models are dynamic, and thus, they change constantly as columns or fields are calculated. Refresh the data model by clicking the Refresh button in the Home tab of PowerPivot. It will give the option of refreshing the current table or all of the tables in PowerPivot, as highlighted in Figure 7.Fig. 7: Refresh Button |
Thanks for reading,
Wayne
No comments:
Post a Comment