Forum Discussion
Oros
Post Prodigy
2 years agoTop Customers
Hello, What would be the correct measure to show the Top 10 customer over a period of time? Thanks. The resulting ranking is not based on the grand total but based on the total sales for a ...
- 2 years ago
Hi,
Please check the below picture and the attached pbix file.
Sales top 3 v3: = VAR _t = ADDCOLUMNS ( SUMMARIZE ( ALLSELECTED ( sales ), customer[customer], 'calendar'[MOnth-Year sort], 'calendar'[Month-Year] ), "@result", CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( WINDOW ( 1, ABS, 3, ABS, CALCULATETABLE ( SUMMARIZE ( sales, customer[customer], 'calendar'[MOnth-Year sort], 'calendar'[Month-Year] ), REMOVEFILTERS ( customer[customer] ) ), ORDERBY ( CALCULATE ( SUM ( sales[sales] ) ), DESC ) ) ) ) ) VAR _list = SUMMARIZE ( FILTER ( _t, [@result] <> BLANK () ), customer[customer] ) RETURN CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( customer[customer] IN _list ) )
Jihwan_Kim
Super User
2 years agoHi,
Please check the below picture and the attached pbix file.
Sales top 3 v3: =
VAR _t =
ADDCOLUMNS (
SUMMARIZE (
ALLSELECTED ( sales ),
customer[customer],
'calendar'[MOnth-Year sort],
'calendar'[Month-Year]
),
"@result",
CALCULATE (
SUM ( sales[sales] ),
KEEPFILTERS (
WINDOW (
1,
ABS,
3,
ABS,
CALCULATETABLE (
SUMMARIZE (
sales,
customer[customer],
'calendar'[MOnth-Year sort],
'calendar'[Month-Year]
),
REMOVEFILTERS ( customer[customer] )
),
ORDERBY ( CALCULATE ( SUM ( sales[sales] ) ), DESC )
)
)
)
)
VAR _list =
SUMMARIZE ( FILTER ( _t, [@result] <> BLANK () ), customer[customer] )
RETURN
CALCULATE ( SUM ( sales[sales] ), KEEPFILTERS ( customer[customer] IN _list ) )
Oros
Post Prodigy
2 years ago