Forum Discussion
hasier
3 years agoFrequent Visitor
Using RANKX to order by date and more criterias
Hi,
I am trying to order one table by date using RankX() but taking into account that when the value is the same on column "Name" the output should be the same and that I only want to order when value at column "Task" is "PUBLISH". It's a bit difficult to explain so I show it with a table and the desired output.
Thank you in advance!
Hi,
Please check the below picture and the attached pbix file.
Rank CC = VAR _newtable = FILTER ( Data, Data[Task] = "PUBLISH" ) VAR _rankcolumn = SUMMARIZE ( ADDCOLUMNS ( _newtable, "@rank", COUNTROWS ( FILTER ( _newtable, Data[Date] <= EARLIER ( Data[Date] ) ) ) ), Data[Name], [@rank] ) RETURN MAXX ( FILTER ( _rankcolumn, Data[Name] = EARLIER ( Data[Name] ) ), [@rank] )
3 Replies
- CNENFRNL
Community Champion
- Jihwan_Kim
Super User
Hi,
Please check the below picture and the attached pbix file.
Rank CC = VAR _newtable = FILTER ( Data, Data[Task] = "PUBLISH" ) VAR _rankcolumn = SUMMARIZE ( ADDCOLUMNS ( _newtable, "@rank", COUNTROWS ( FILTER ( _newtable, Data[Date] <= EARLIER ( Data[Date] ) ) ) ), Data[Name], [@rank] ) RETURN MAXX ( FILTER ( _rankcolumn, Data[Name] = EARLIER ( Data[Name] ) ), [@rank] ) - hasierFrequent Visitor
Thank you very much! It works perfectly fine 😄