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
slackerhx
Helper II
Helper II

Multiple Ranking Columns in Power Query

 

Hi All, 

 

I'm trying to search for a solution to create multiple ranking columns in Power Query. 

 

Previously, i was using Excel as data source and manage to create multiple ranking columns for the different attributes using Excel's RANK function. After which, i can unpivot the column names in Power Query to form Attributes and Rank columns. Please see data sample below: 

 

EXCEL:

 

CityGDP Per CapitaRank by GDPUnemployment RateRank by Unemployment RateAir Passenger VolumeRank by Air Passenger Volume
Sydney6700114.60%2462166073
Taipei4417323.90%3535079612
Beijing1781131.24%41018786001
Manila1561546.38%1431008154

 

Power Query: 

 

CityAttributesRank
SydneyRank by GDP1
SydneyRank by Unemployment Rate2
SydneyRank by Air Passenger Volume3
TaipeiRank by GDP2
TaipeiRank by Unemployment Rate3
TaipeiRank by Air Passenger Volume2
BeijingRank by GDP3
BeijingRank by Unemployment Rate4
BeijingRank by Air Passenger Volume1
ManilaRank by GDP4
ManilaRank by Unemployment Rate1
ManilaRank by Air Passenger Volume4

 

However, due to company policy, i have to change my source to Sharepoint List which makes it necessary for me to re-create the Ranking Columns in PowerBI instead.

 

I have tried creating the ranking using DAX, however, if the ranking was done through DAX, i'm not sure how i can unpivot the different Ranking Field Names to rows under an Attribute Column as shown above. I will need to have "Attribute" and "Rank" columns for use in the Radar Chart visual. 

 

I would greatly appreciate if anyone can enlighten me using DAX or Power Query to achieve the above Attribute and Rank columns and it is also necessary to have ties in the Ranks. 

 

Thank you. 

 

 

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @slackerhx

This formula will help with DAX

Table =
VAR table1 =
    SUMMARIZE ( Sheet1, [City], [Rank by GDP], "Attributes", "Rank by GDP" )
VAR table2 =
    SUMMARIZE (
        Sheet1,
        [City],
        [Rank by Unemployment Rate],
        "Attributes", "Rank by Unemployment Rate"
    )
VAR table3 =
    SUMMARIZE (
        Sheet1,
        [City],
        [Rank by Air Passenger Volume],
        "Attributes", "Rank by Air Passenger Volume"
    )
RETURN
    UNION ( table1, table2, table3 )

5.png

 

Best Regards

Maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @slackerhx

This formula will help with DAX

Table =
VAR table1 =
    SUMMARIZE ( Sheet1, [City], [Rank by GDP], "Attributes", "Rank by GDP" )
VAR table2 =
    SUMMARIZE (
        Sheet1,
        [City],
        [Rank by Unemployment Rate],
        "Attributes", "Rank by Unemployment Rate"
    )
VAR table3 =
    SUMMARIZE (
        Sheet1,
        [City],
        [Rank by Air Passenger Volume],
        "Attributes", "Rank by Air Passenger Volume"
    )
RETURN
    UNION ( table1, table2, table3 )

5.png

 

Best Regards

Maggie

thanks Maggie ! @v-juanli-msft

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.