Skip to content

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

>> Download the sample (Power BI)

This sample compares Total Sales against Total Sales LY, based on a discrete grouping of customers (e.g. Outlier, Non-Outlier), depending on each customer’s total sales and sales growth.

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

Total Sales (Disaggregated into Groups based on each Customers Total Sales and Sales Growth - Non-Outlier)

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

Total Sales (Disaggregated into Groups based on each Customers Total Sales and Sales Growth - Outlier)

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

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

Section titled “Total Sales (Disaggregated into Groups based on each Customers Total Sales and Sales Growth)”
Total Sales (Disaggregated into Groups based on each Customers Total Sales and Sales Growth) =
IF (
SELECTEDVALUE ( 'Customer Outlier Logic Groups'[Group] ) = "Outlier",
[Total Sales (Disaggregated into Groups based on each Customers Total Sales and Sales Growth - Outlier)],
[Total Sales (Disaggregated into Groups based on each Customers Total Sales and Sales Growth - Non-Outlier)]
)
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 )
)