Hi,
My DAX code with TOPN DESC works fine although the column is not sorted as need. But the bigger issue I have is I cannot get the ASC (bottom) to work properly. It returns all the rows and ignores the TOPN filter, e.g, top 5 (ASC) are not returned rather the whole rows in the column come through.
My DAX code:
Top 5 Customers Per Region =
VAR
RankingContext = VALUES( 'Customers'[Customer Name] )
RETURN
CALCULATE( [Sales Amount],
TOPN( 5,
ALL( 'Customers'[Customer Name] ),
[Sales Amount] ),
RankingContext)
The below does not work:
Bottom 5 = CALCULATE( [Sales Amount],
TOPN ( 5, VALUES ( Customers[Customer Name] ), [Sales Amount], ASC ))
I equally tried:
Bottom 5 Customers =
VAR CustomerRankX =
RANKX ( ALL (Customers[Customer Name] ),
SUMX
( Orders, Orders[Sales Quantity] * Orders[Unity Price] ),,ASC )
RETURN
IF (CustomerRankX <= 5,
SUMX ( Orders, Orders[Sales Quantity] * Orders[Unity Price] ) , BLANK() )
and the below did not work either:
Bottom 3 Customers Per Region =
VAR
RankingContext = VALUES( Customers )
RETURN
CALCULATE( [Sales Amount],
TOPN( 3,
ALL( Customers[Customer Area], Customers[Customer Name] ),
[Sales Amount],ASC, [Sales Amount] ),
RankingContext )
I want to create a report that shows the top 5 and the bottom 5 customers per region against the value of sales.
I anticipate your help.
Thank you