Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ngiam
Helper I
Helper I

Filter Value then Rank them by descending order

Hi All,

 

I got a table in power bi with the following structure

Name | %C | %A | %T | %U |

Paul | 60% | 56% | 34% | 75%|

 

How do I get power bi using DAX to read the % and if any % in the | %C | %A | %T | %U | is above 50%, it will capture the alphabet according to the descending value of the %. For example, for Paul, the column next to him should read UCA

 

Thank you in advance!

1 ACCEPTED SOLUTION
ngiam
Helper I
Helper I

Closing the loop here. Manage to find the answer eventually:

UCA_Column =
VAR CValue = IF ( table1[C3%] >= 0.5, 1, 0 )
VAR UValue = IF ( table1[U3%] >= 0.5, 1, 0 )
VAR TValue = IF ( table1[T3%] >= 0.5, 1, 0 )
VAR AValue = IF ( table1[A3%] >= 0.5, 1, 0 )
VAR AttributeTable = FILTER (
        UNION(
            ROW("Attribute", "C", "Percentage", table1[C3%] * 100, "Include", CValue),
            ROW("Attribute", "U", "Percentage", table1[U3%] * 100, "Include", UValue),
            ROW("Attribute", "T", "Percentage", table1[T3%] * 100, "Include", TValue),
            ROW("Attribute", "A", "Percentage", table1[A3%] * 100, "Include", AValue)
        ),
        [Include] = 1
    )
VAR RankTable = ADDCOLUMNS(AttributeTable, "Rank", RANKX(AttributeTable, [Percentage], , ASC, Dense))
RETURN
    CONCATENATEX(RankTable, [Attribute], "", [Percentage], DESC)

View solution in original post

3 REPLIES 3
ngiam
Helper I
Helper I

Closing the loop here. Manage to find the answer eventually:

UCA_Column =
VAR CValue = IF ( table1[C3%] >= 0.5, 1, 0 )
VAR UValue = IF ( table1[U3%] >= 0.5, 1, 0 )
VAR TValue = IF ( table1[T3%] >= 0.5, 1, 0 )
VAR AValue = IF ( table1[A3%] >= 0.5, 1, 0 )
VAR AttributeTable = FILTER (
        UNION(
            ROW("Attribute", "C", "Percentage", table1[C3%] * 100, "Include", CValue),
            ROW("Attribute", "U", "Percentage", table1[U3%] * 100, "Include", UValue),
            ROW("Attribute", "T", "Percentage", table1[T3%] * 100, "Include", TValue),
            ROW("Attribute", "A", "Percentage", table1[A3%] * 100, "Include", AValue)
        ),
        [Include] = 1
    )
VAR RankTable = ADDCOLUMNS(AttributeTable, "Rank", RANKX(AttributeTable, [Percentage], , ASC, Dense))
RETURN
    CONCATENATEX(RankTable, [Attribute], "", [Percentage], DESC)
Sahir_Maharaj
Super User
Super User

Hello @ngiam,

 

Can you please try this: 

UCA Column = 
VAR SortedTable =
    SORT (
        ADDCOLUMNS (
            FILTER (
                ALL ( Table1 ),
                Table1[Name] = SELECTEDVALUE ( Table1[Name] )
            ),
            "Attribute", SWITCH (
                TRUE (),
                Table1[%C] >= 0.5, "%C",
                Table1[%A] >= 0.5, "%A",
                Table1[%T] >= 0.5, "%T",
                Table1[%U] >= 0.5, "%U"
            )
        ),
        [Attribute], DESC
    )
RETURN
    CONCATENATEX ( SortedTable, SortedTable[Attribute], "" )

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi @Sahir_Maharaj ,

 

Thank you for your support. I'm getting this error code: Failed to resolve name 'SORT'. It is not a valid table, variable, or function name.

 

Is there something that I should do from my end?

 

Thanks

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors