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
Hayoung
Helper IV
Helper IV

display the percentage by descending order and top3 as dark blue for current and last survey result

I would like to show and compare the % in descending order for current survey and previous survey to make a table visuals, with the top 3 as dark blue and other as blue.(Survey id is smaller means it is earlier date). I have tried to add measure by 

 

Current result% = SUM('TOP3'[%])
 
Previous result% =
var _date= maxx(filter('TOP3', 'TOP3'[Name] = earlier('TOP3'[Name]) && 'TOP3'[Date] < earlier('TOP3'[Date]) ), 'TOP3'[Date])
Return
CALCULATE([Current result%],
FILTER(ALL('TOP3'),[Survey ID]=_date
                    &&[Name]=SELECTEDVALUE('Q20_TOP3'[Name])
                    &&[Merged(Q&A)]=SELECTEDVALUE('TOP3'[Merged(Q&A)])))
 

Rank = RANKX(CALCULATETABLE(TOP3,ALLEXCEPT(TOP3,TOP3[Survey ID])), TOP3[%],,DESC)

Bar Color = if([Rank(current)] <= 3, "dark blue", "blue")

 

Below is my sample data.

Survey idName%Merged(Q&A)RankDate
ABC123A50%Q1_A1109/09/2022
ABC123A40%Q1_A2209/09/2022
ABC123A30%Q1_A5309/09/2022
ABC123A1%Q1_A4509/09/2022
ABC123A5%Q1_A6409/09/2022
ABC123A0%Q1_A3609/09/2022
ABC234A50%Q1_A1118/09/2022
ABC234A2%Q1_A2418/09/2022
ABC234A15%Q1_A5218/09/2022
ABC234A1%Q1_A4518/09/2022
ABC234A8%Q1_A6318/09/2022
ABC234A0%Q1_A3618/09/2022
ABC345B20%Q1_A1307/09/2022
ABC345B30%Q1_A2107/09/2022
ABC345B30%Q1_A5207/09/2022
ABC345B1%Q1_A4507/09/2022
ABC345B5%Q1_A6407/09/2022
ABC345B0%Q1_A3607/09/2022
ABC456B10%Q1_A1220/09/2022
ABC456B5%Q1_A2320/09/2022
ABC456B30%Q1_A5120/09/2022
ABC456B1%Q1_A4520/09/2022
ABC456B3%Q1_A6420/09/2022
ABC456B0%Q1_A3620/09/2022
 
My expected result is table visuals like below:
Hayoung_0-1666579347197.png

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Hayoung ,

 

Try formula like below:

set_ =
RANKX (
    FILTER ( ALL ( TOP3 ), TOP3[Name] = MAX ( TOP3[Name] ) ),
    CALCULATE ( SUM ( TOP3[%] ) ),
    ,
    DESC,
    SKIP
)
color = IF([set_] in {1,3,4},"blue","light blue") 

vhenrykmstf_0-1666664962878.png


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-henryk-mstf
Community Support
Community Support

Hi @Hayoung ,

 

Try formula like below:

set_ =
RANKX (
    FILTER ( ALL ( TOP3 ), TOP3[Name] = MAX ( TOP3[Name] ) ),
    CALCULATE ( SUM ( TOP3[%] ) ),
    ,
    DESC,
    SKIP
)
color = IF([set_] in {1,3,4},"blue","light blue") 

vhenrykmstf_0-1666664962878.png


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.