Sum Top and Bottom 10 Products by Sales in Power BI

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 top 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!

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s