>> Download the sample (Power BI)
This sample compares profit margins and Total Sales, based on a discrete grouping of customers (e.g. Good Clients, Ok Clients, Poor Clients and Top Clients), depending on each customer’s total profit.
It does this in two ways:
(i) Where the grouping of customers is predetermined as a calculated column in the Customer table
(ii) Where the grouping of customers is determined on the fly with dynamic measures, so that it responds to any page filters that might also be applied
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Sales, Profits, & Customers
Section titled “Measures - Sales, Profits, & Customers”Profit Margin
Section titled “Profit Margin”Profit Margin =DIVIDE ( [Total Profits], [Total Sales], 0 )Profit Margins (Disaggregated into Groups based on each Customers Total Profit)
Section titled “Profit Margins (Disaggregated into Groups based on each Customers Total Profit)”Profit Margins (Disaggregated into Groups based on each Customers Total Profit) =VAR RankingDimension = VALUES ( Customer_Table[Customer] )RETURN CALCULATE ( [Profit Margin], FILTER ( RankingDimension, COUNTROWS ( FILTER ( 'Customer Total Profit Groups', [Total Profits] >= 'Customer Total Profit Groups'[Min] && [Total Profits] < 'Customer Total Profit Groups'[ Max ] ) ) > 0 ) )Total Costs
Section titled “Total Costs”Total Costs =SUMX ( Sales_Table, Sales_Table[Unit Cost] * Sales_Table[Quantity] )Total Profits
Section titled “Total Profits”Total Profits =[Total Sales] - [Total Costs]Total Sales
Section titled “Total Sales”Total Sales =SUMX ( Sales_Table, Sales_Table[Unit Price] * Sales_Table[Quantity] )Total Sales (Disaggregated into Groups based on each Customers Total Profit)
Section titled “Total Sales (Disaggregated into Groups based on each Customers Total Profit)”Total Sales (Disaggregated into Groups based on each Customers Total Profit) =VAR RankingDimension = VALUES ( Customer_Table[Customer] )RETURN CALCULATE ( [Total Sales], FILTER ( RankingDimension, COUNTROWS ( FILTER ( 'Customer Total Profit Groups', [Total Profits] >= 'Customer Total Profit Groups'[Min] && [Total Profits] < 'Customer Total Profit Groups'[ Max ] ) ) > 0 ) )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 ))