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
jeffgarlisch
Helper I
Helper I

RANKX showing duplicated ranks for different values

Hey All, 

 

 

Ive used both these RANKX functions to calculate the ranking based on a measure and it is returning duplicate values for certain rows, as well as skipping numbers. As you can see  in the screenshot below the numbers are not the same so i'm not sure what is happening here. 

 

I've looked at all the other isntances of this happening and have not been able to find a solution that worked for me.

 

Any advice is apprecaited!

 

Ranking = RANKX(ALL(QUALNUMJULY[CAI],QUALNUMJULY[Qualification]),[% Diff All],,0,DENSE)


Ranking = RANKX(ALL(QUALNUMJULY[CAI],QUALNUMJULY[Qualification]),[% Diff All],,0)

Ranking = RANKX(QualNumJuly,[% Diff All],,0)

Capture.JPG

 

 

I am calculating the % Diff column using these three DAX formulas

 

 

Calculates % of Column Total for all Categories

%OfAllTotal = Divide([Total Qual],CALCULATE([Total Qual],ALL(QUALNUMJULY[Qualification],QUALNUMJULY[CAI],QUALNUMJULY[DBAName],QUALNUMJULY[AccountNumber])))
Calculates total records

Total Qual = COUNT(QUALNUMJULY[Qualification])

 

Calculates the % Difference between Column Totals Based on available data sources

% Diff All = CALCULATE(QUALNUMJULY[%OfAllTotal],QUALNUMJULY[SourceIdentification] = "<A>") - CALCULATE(CALCULATE(QUALNUMJULY[%OfAllTotal],QUALNUMJULY[SourceIdentification] = "<Y>"))

 

 

The % Difference should always be calculated as DataSource A - DataSource Y.

 

At the moment there are only two data sources, in the future there will be many more, DataSource C, D, E....

 

Datasource Y will be a constant value, and Datasource A will change per Datasource.

2 REPLIES 2
Seward12533
Solution Sage
Solution Sage

I'm still learning RANKX but I thinkg your ALL is causing values filtered out of your report that the calcualtion is considering. 

Still having the same issue without the ALL. 

 

 

Here Are the DAX Formulas running my measure.

 

 

Calculates Total Records

 

 

Total Qual = COUNT(QUALNUMJULY[Qualification])

 

 

Calculates % Column Total per Categories

 

 

%OfAllTotal = Divide([Total Qual],CALCULATE([Total Qual],ALL(QUALNUMJULY[Qualification],QUALNUMJULY[CAI],QUALNUMJULY[DBAName],QUALNUMJULY[AccountNumber])))


Calculates Percent Difference Between % Column Total Per Data Source

 

% Diff All = (CALCULATE(QUALNUMJULY[%OfAllTotal],QUALNUMJULY[SourceIdentification] = "<Pivotal Payments>")) - (CALCULATE(QUALNUMJULY[%OfAllTotal],QUALNUMJULY[SourceIdentification] = "<CT Payments>"))

 

 

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.