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
anandav
Skilled Sharer
Skilled Sharer

RANKX() issue

Hi All,

 

I have a the below RANKX function:

 

Rank of Country by Selection =
    RANKX(
        ALL(Data[Country]),
        CALCULATE(
            SUM(Data[Price])
        ),,DESC,Dense
     )

 

The data is from a MS SQL database retrieved as Import query.

 

The RANKX() works when I display the Country and Price in a table. But as soon as I add Quantity column the rank does not work for 1 and 2. See image below.

RankIssue.jpg

 

When I export the data of the table from Power BI visual and do the same RANKX() function, then ranking works propoerly even with Quantity.

 

I am guessing this must be something to do with the data from database but cannot think of what.

Any help will be appreciated.

2 REPLIES 2
MFelix
Super User
Super User

Hi @anandav,

 

I was not abble to reproduce using my version of PBI and a mockup of your data so everything should work based on your dax measure, can you give a bigger sample of your data wih the full table layout and contents or a mockup of the PBIX.

 

The measure in DAX should I even added some additional columns like dates and categories and all went well except when adding formulas that had additional details like dates, but using values in the table the result was as expected.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix,

 

Thanks for your reply.

When I tried the dataset as a csv file (about 50K rows) and used the same measure everything works well.

The issue occurs only when I connect to database and Import data. So providing the dataset in csv or Excel will not reproduce the issue.

 

I understand it is difficult to answer without being able to reporduce the issue, but unfortunately since it is company production data it is not possible to access from outside. But same data in csv or Excel file when used with the same measure works properly.

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.