Forum Discussion
Anonymous
4 years agoNot applicable
Need RANKX to exclude Blanks
Dear PBI enthusiasts! I am relatively new to PowerBI and struggling through this one scenario. Use case - I have a parameter (type of customer - Domestic / International / Contractors) and depend...
daXtreme
Solution Sage
4 years agoIn the RANKX function, don't use the whole table as the first argument but FILTER it by the cells/entries that don't have BLANKs. That's also simple. And if the cell is BLANK, just don't calculate the rank. Something like:
[Ranking] =
var AllItemsNonBlank =
filter(
// Due to ALLSELECTED this is a relatve
// ranking. If you want an absolute ranking,
// use ALL( T[Item] ) instead.
allselected( T[Item] ),
not isblank( [your measure to rank with] )
)
var Result =
if( not isblank( [your measure to rank with] ),
rankx(
AllItemsNonBlank,
[your measure to rank with]
)
)
return
Result