Skip to content

Total Sales vs Total Sales LY, based on a Binary Grouping of Customers by their Sales Growth

>> Download the sample (Power BI)

This sample compares Total Sales and Total Sales LY, based on a binary grouping of customers (e.g. Negative Growth, Positive Growth), depending on each customer’s sales growth.

Total Sales =
SUMX ( Sales_Table, Sales_Table[Unit Price] * Sales_Table[Quantity] )

Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Negative)

Section titled “Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Negative)”
Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Negative) =
CALCULATE (
[Total Sales],
FILTER (
VALUES ( Customer_Table[Customer] ),
COUNTROWS (
FILTER (
'Customer Sales Growth Binary Group',
[Total Sales Growth %] < 'Customer Sales Growth Binary Group'[Max]
)
) > 0
)
)

Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Positive)

Section titled “Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Positive)”
Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Positive) =
CALCULATE (
[Total Sales],
FILTER (
VALUES ( Customer_Table[Customer] ),
COUNTROWS (
FILTER (
'Customer Sales Growth Binary Group',
[Total Sales Growth %] >= 'Customer Sales Growth Binary Group'[Min]
)
) > 0
)
)

Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth)

Section titled “Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth)”
Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth) =
IF (
SELECTEDVALUE ( 'Customer Sales Growth Binary Group'[Group] ) = "Positive Growth",
[Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Positive)],
[Total Sales (Disaggregated into Binary Groups based on each Customers Sales Growth - Negative)]
)
Total Sales Growth % =
DIVIDE ( [Total Sales] - [Total Sales LY], [Total Sales LY], 0 )
Total Sales LY =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( Calendar_Table[Date] ) )
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 )
)