If you are a business selling products in many different stores or across lot of different regions you will want to understand if there is any commonality in your top or bottom selling products.
In this example I run through how you can find your top 2 products using DAX calculations in Power BI to do just that.
I can see this being also really valuable if you were looking for outliers in your data over time. Maybe you identify that some products sell very well in particular regions over others and there may be an opportunity to take advantage of this with promotions and upsells etc.
So many opportunities to add value with these types of insights.
In this video I run through the DAX formula required to achieve this particular insight. With a focus on how to use TOPN inside the CALCULATE statement.
This is a great pattern that could be used in many different ways, so a great one to learn really well. Understanding how TOPN internally calculates a ranking on the fly and then creates a context inside of CALCULATE which isolates the top (in this case) products for sale.
Also don’t forget the VALUES function. You need this to bring back the product name context to get this calculation to work properly.
As always DAX is an amazing analytical language which is worth learning really well if you are getting into Power BI. Really, if you not learning DAX you missing out on 90% of what you can achieve inside Power BI.
Enjoy learning about this technique and make sure to look to apply it in your own environments to embed the concepts in your minds.
Check out the full video below