In this video we will cover how to calculate the aggregate sum of only the Top and Bottom 10 Product Sales using DAX in Power BI. There are always multiple ways to accomplish a task with Power BI and DAX but I will share the technique I used to visualize the Bottom 10 Sales Products when there is a rare single tie among the products. The solution may be a bit over-engineered to my data-set but the aim is to share an approach you can use to tackle similar data issues in your dashboards. It’s well worth the watch!
I won’t give way the whole video but I’ll share the DAX formula to sum the Top 10 products by Sales Price from my table named ‘Company Sales Data’.
1_SumSalesTop10Products = CALCULATE( SUM('Company Sales Data'[Sales Price]), TOPN( 10,GROUPBY('Company Sales Data','Company Sales Data'[Product]), CALCULATE(sum('Company Sales Data'[Sales Price])) ) )
I have created a variable named 1_SumSalesTop10Products that uses the CALCULATE function to
- SUM the [Sales Price] variable from the [Company Sales Data] table (see the first argument to the CALCULATE function);
- But it only sums the [Sales Price] for the TOP 10 highest selling products, because we use the TOP N function to create a temporary table that only returns the products with the 10 highest aggregated Sales Prices;
- The GROUP BY function is used to aggregate the table rows by product and then the CALCULATE argument sums the Sales Price for the aggregated products;
Don’t let this scare you off, watch the video to get a better understanding, and to learn how I sum the Bottom 10 products by Sales Price.
As always, get out there and do some great things with your data!
- If you find this type of instruction valuable make sure to subscribe to my Youtube channel.
- Watch Part 1 of this series here: Top and Bottom 10 Products by Sales Using RANKX in Power BI
- All views and opinions are solely my own and do NOT necessarily reflect those of my employer.