cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
crdok Frequent Visitor
Frequent Visitor

Power BI conditional indexing

Hi, I am trying to index some countries in a table based on values from a column. So for example : I have a list of 5 countries ( AU, BR, CA, CH, CL); If AU has the maximum value in column (notional) then I would like to get an index of 1 for it. If the second max value in column ( notional) is CA, then I would like it to be indexed with 2 and so on and so forth. Is this possible ? Many thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Power BI conditional indexing

Hey,

 

what you are looking for can be achieved using the DAX function RANKX(), that is described here:

https://msdn.microsoft.com/en-us/query-bi/dax/rankx-function-dax

 

If you need more help, just search for RANKX in this forum.

 

If you do not find your answer, consider to create a little pbix file, upload the file to Onedrive or dropbox and share the link.

 

Hopefully this gets you started.

 

Regards,

Tom

Hamburg - Germany
If I answer you question, please mark my post as solution, this will also help others.
Proud to be a Datanaut!
3 REPLIES 3
crdok Frequent Visitor
Frequent Visitor

Power bi conditional indexing

Hi, I would like to index a category ( in this case countries) based on the values in another column ( notional). For example: we have a column which has 5 countries ( AU, BE,DE,AT,CN,TH); If the maximum value in column notional is for AU then I would like to assign index number one to it. If the second maximum value in notional is for AT then  index value for AT should be 2, and so on and so forth. Is this possible? Thank you 

Super User
Super User

Re: Power bi conditional indexing

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


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


Super User
Super User

Re: Power BI conditional indexing

Hey,

 

what you are looking for can be achieved using the DAX function RANKX(), that is described here:

https://msdn.microsoft.com/en-us/query-bi/dax/rankx-function-dax

 

If you need more help, just search for RANKX in this forum.

 

If you do not find your answer, consider to create a little pbix file, upload the file to Onedrive or dropbox and share the link.

 

Hopefully this gets you started.

 

Regards,

Tom

Hamburg - Germany
If I answer you question, please mark my post as solution, this will also help others.
Proud to be a Datanaut!