Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
crdok
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
TomMartens
Super User
Super User

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



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
crdok
Frequent Visitor

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 

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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
TomMartens
Super User
Super User

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



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.