>> Download the sample (Power BI)
This sample shows a dynamic ranking of:
(i) Top Customers by Sales
(ii) Top Customers by Profits
(iii) Top Customers by Profit Margins
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Sales & Profits
Section titled “Measures - Sales & Profits”Profit Margins
Section titled “Profit Margins”Profit Margins =DIVIDE ( [Total Profits], [Total Revenue], 0 )Top Margins by Rank
Section titled “Top Margins by Rank”Top Margins by Rank =VAR RankingDimension = VALUES ( Customer_Table[Customer] )VAR RankingSelect = Ranking_Table[Ranking Select]RETURN CALCULATE ( [Profit Margins], FILTER ( RankingDimension, RANKX ( ALL ( Customer_Table[Customer] ), [Profit Margins],, DESC ) <= RankingSelect ) )Top Profits by Rank
Section titled “Top Profits by Rank”Top Profits by Rank =VAR RankingDimension = VALUES ( Customer_Table[Customer] )VAR RankingSelect = Ranking_Table[Ranking Select]RETURN CALCULATE ( [Total Profits], FILTER ( RankingDimension, RANKX ( ALL ( Customer_Table[Customer] ), [Total Profits],, DESC ) <= RankingSelect ) )Top Sales by Rank
Section titled “Top Sales by Rank”Top Sales by Rank =VAR RankingDimension = VALUES ( Customer_Table[Customer] )VAR RankingSelect = Ranking_Table[Ranking Select]RETURN CALCULATE ( [Total Revenue], FILTER ( RankingDimension, RANKX ( ALL ( Customer_Table[Customer] ), [Total Revenue],, DESC ) <= RankingSelect ) )Total Costs
Section titled “Total Costs”Total Costs =SUMX ( Sales_Table, Sales_Table[Quantity] * Sales_Table[Unit Cost] )Total Profits
Section titled “Total Profits”Total Profits =[Total Revenue] - [Total Costs]Total Revenue
Section titled “Total Revenue”Total Revenue =SUMX ( Sales_Table, Sales_Table[Quantity] * Sales_Table[Unit Price] )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 ))