Forum Discussion

crdok's avatar
crdok
Frequent Visitor
8 years ago
Solved

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 

  • 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

3 Replies

  • 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

  • crdok's avatar
    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