Skip to content

Sales of Top most selling, and Bottom most selling Product, for each Customer

>> Download the sample (Power BI)

This sample shows the sales of the top-selling and bottom-selling product for each customer.

Sales Bottom 1 Product =
CALCULATE (
[SUMX Total Sales],
TOPN ( 1, VALUES ( Sales_Table[Product] ), [SUMX Total Sales], ASC )
)
Sales Top 1 Product =
CALCULATE (
[SUMX Total Sales],
TOPN ( 1, VALUES ( Sales_Table[Product] ), [SUMX Total Sales], DESC )
)
SUMX Total Sales =
SUMX ( Sales_Table, Sales_Table[Quantity] * Sales_Table[Unit Price] )
Total Products =
COUNTROWS ( VALUES ( Sales_Table[Product] ) )
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 )
)