Reputation: 434
I'm struggling with an issue where I'm trying to use TopN in a measure but the order specified (asc/desc) doesn’t turn out right. Example:
CONCATENATEX (
topn( 5,
all( 'Table'[Column] ),
calculate( COUNT( 'Table'[Column]) ),
desc
),
'Table'[Column],
unichar(10)
)
The measure outputs the right counted col values (5 most frequently occurring) but in a backwards order (asc vs desc) and it wont let me fix it even though I’ve tried a bunch of different methods including RANKX.
Similar questions:
https://community.powerbi.com/t5/DAX-Commands-and-Tips/DAX-Measure-Sort-by-issue/td-p/1116147
ASC parameter when using TOPN function in Power BI
Upvotes: 0
Views: 1095
Reputation: 434
"The order parameter of the TOPN part is just about the ordering of which part to select for to iterate for CONCATENATEX - not about the order of the iterator. There are optional arguments for CONCATENATEX to decide in which order it should iterator the table. You can use these like this:"
CONCATENATEX (
...
UNICHAR(10),
**'Table'[Column],
DESC**
)
Upvotes: 0