Forum Discussion
Need Help with Rankx
I think we need some more context around this, can you provide example/sample data? Is there some group/category column you are using that you are ranking? Here is a RANKX problem that I solved yesterday:
Measure = VAR __currentCategory = MAX(CategoryRanks[Category]) VAR __tmpTable = ALL(CategoryRanks) VAR __tmpTable1 = SUMMARIZE(__tmpTable,CategoryRanks[Category],"__Count",COUNT(CategoryRanks[Category])) VAR __tmpTable2 = ADDCOLUMNS(__tmpTable1,"__Rank",RANKX(__tmpTable1,[__Count],,,Skip)) RETURN MAXX(FILTER(__tmpTable2,[Category]=__currentCategory),[__Rank])
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Thanks!
Here are the pictures of resultsets. I have masked some columns for confidentiality reasons.
I am giving here an example of rank based on column called "Unmonitored Assets".
Here is how Unmonitored Assets (a measure) is calculated:
Unmonitored Assets = CALCULATE(DISTINCTCOUNT(TableName [AssetName]), TableName [Excepted_Assets] = 0) + 0 --> filtering on column Excepted_assets = 0 and getting the distinct count for those assets.
The rank measure is as follows:
Rank = RANKX (all(TableName),[Unmonitored Assets]) -- > I want to rank the table based on number of "Unmonitored Assets".
Here is what I see:
Rank = 1 for all Unmonitored Assets >0
Rank = 160001 for all Unmonitored Assets =0
What is going on, anyone?
- Greg_Deckler8 years ago
Community Champion
Need a sense of your source data. In that table, do [AssetName]'s appear once or multiple times? I really think that you need to do a SUMMARIZE of your table based on some grouping of which I am not clear about yet and then do an ADDCOLUMNS to add a rank column as shown in previous reply.