>> Download the sample (Power BI)
This sample determines what the top 2 selling products are,
(i) By sales, and (ii) By sales units,
for each region.
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Sales
Section titled “Measures - Sales”Total Sales
Section titled “Total Sales”Total Sales =SUMX ( Sales_Table, Sales_Table[Unit Price] * Sales_Table[Quantity] )Total Sales of Top 2 Best Selling Products
Section titled “Total Sales of Top 2 Best Selling Products”Total Sales of Top 2 Best Selling Products =CALCULATE ( [Total Sales], TOPN ( 2, ALL ( Products_Table[Products] ), [Total Sales] ), VALUES ( Products_Table[Products] ))Total Sales Units of Top 2 Best Selling Products
Section titled “Total Sales Units of Top 2 Best Selling Products”Total Sales Units of Top 2 Best Selling Products =CALCULATE ( CALCULATE ( SUM ( Sales_Table[Quantity] ) ), TOPN ( 2, ALL ( Products_Table[Products] ), CALCULATE ( SUM ( Sales_Table[Quantity] ) ) ), VALUES ( Products_Table[Products] ))Tables
Section titled “Tables”Calendar_Table
Section titled “Calendar_Table”Calendar_Table =GENERATE ( CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2019, 12, 31 ) ), VAR currentDay = [Date] VAR Day = DAY ( currentDay ) VAR Month = MONTH ( currentDay ) VAR Year = YEAR ( currentDay ) RETURN ROW ( "Day", day, "Month", month, "Year", year ))