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

RANKX showing duplicated values

Hi,

I getting a issue where when i try to use RANKX to rank some data im getting duplicated values 

Measure im using : rankx(allselected(Dados[Turmas/Ano]); calculate(SUMX(Dados;Dados[MódulosAtraso]));;;Skip)

Sample Data:

School     NameofClass  MódulosAtraso  Rank

Porto          Class1                   900               1

Viseu          Class10                 560               1

Porto          Class20                 820               2

Viseu          Class4                   400               2

 

Expected Result would be:

School    NameofClass       MóduloAtraso      Rank

Porto           Class1                    900                   1               

Porto           Class10                  820                   2

Viseu           Class20                  560                   3

Viseu           Class4                    400                   4

 

OBS : Each school has unique ID for example :

SchoolID School

1                Porto

2                Viseu

1 ACCEPTED SOLUTION

@tex628 Thanks for all the help i already found a way to show the information i wanted so instead of using my SchoolName i used the ClassID and now its showing the results i wanted .

As my ClassID they have schools names abbreviated as for examples PORGpsi1619 , i made table with the abreviattions and the school names so in the meetups people can understand what the 3 first letters means 

 

 

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

May try to use the following DAX, add more conditions in ALL functions

 

Rank = RANKX(ALL(School[NameofClass],School[School]),CALCULATE(SUM(School[MódulosAtraso])),,DESC)

2018-07-05_10-05-17.png

 

@Anonymous hey thanks for the help but when i use your formula it gives me a error :

All column arguments of the ALL/ALLNOBLANKROW function must be from the same table.

 

This is my relationship if it helps :

Im going to translate the tables because they are in portuguese so table "Escola" = School where u have IdSchool and SchoolName

"Turmas"="ClassData" in this table is where i get have my table with all ids matching up .

"Dados" = "Class" where i have ClassName and MódulosAtraso 

 

 

Capture.PNG

tex628
Community Champion
Community Champion

May I ask what is the purpose of creating this ranking, is it to filter on rank or simply to display the rank?

 

/ J


Connect on LinkedIn

@tex628 the purpose of this rank is to show in meeting to show the top 5 class with more "MódulosAtraso" in our group of Schools , the ranks its already filter to show only top 5 

tex628
Community Champion
Community Champion

Try this:

 

Go into filtersGo into filtersChosoe Top N instead of basicChosoe Top N instead of basicWrite 5 in top and then by  value "ModuloAtraso"Write 5 in top and then by value "ModuloAtraso"


Connect on LinkedIn

@tex628 Hey i tried your method but it doens't filter top 5 neither gives me only top 5 as i would like as this : 

School         ClassName            MódulosAtraso            Rank

Porto                 Class1                     900                          1

Viseu                 Class1                     760                          2

Viseu                 Class90                   750                          3

Porto                 Class20                   600                          4

Porto                 Class19                   550                          5

tex628
Community Champion
Community Champion

Sorry i was away at lunch.

 

I think theres something im missing or missunderstanding, do you think you could provide a picture of your visuals?

/ J


Connect on LinkedIn

@tex628 Thanks for all the help i already found a way to show the information i wanted so instead of using my SchoolName i used the ClassID and now its showing the results i wanted .

As my ClassID they have schools names abbreviated as for examples PORGpsi1619 , i made table with the abreviattions and the school names so in the meetups people can understand what the 3 first letters means 

 

 

tex628
Community Champion
Community Champion

Alright! Glad it worked out! 

/ J


Connect on LinkedIn
Phil_Seamark
Employee
Employee

Hi @rui_silva

 

This calculated column matches your expected results

 

My Rank = RANKX('Table','Table'[MódulosAtraso])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hey thanks for helping me but when i try use your function it gives me a error :

A single value for column 'MódulosAtraso' in table 'Dados' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

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.

Top Solution Authors