Forum Discussion
traviscole
5 years agoAdvocate I
TOPN sorting
I am hardcore failing at making TOPN work in DAX instead of the filters on a visual. I have tried and looked at a million different things and ways of doing it in my real data set and this dummy sam...
- 5 years agoVolume total : =SUM(Volume[Volume])Top five volume measure : =CALCULATE ([Volume total :],KEEPFILTERS ( TOPN ( 5, ALL ( Items ), [Volume total :], DESC ) ))
AlexisOlson
5 years agoSuper User
If you check the documentation for TOPN (here and/or here), you may notice that it returns a table as its output, not a single value. A measure can only return a single value.
The easiest approach is usually to use the Top N filtering option in the filter pane.
See here too: https://community.powerbi.com/t5/Desktop/TopN/m-p/131646