Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Conditional formatting - top 3 clustered column chart

Hello all,

 

I'm trying to get a top 3 clustered column chart where I can conditional format the following:

#1: color gold

#2: color silver

#3: color bronz 

 

The data is as followed:

AreaSales
Midden170
Noord169
Zuid140
Oost120
West40

 

I've tried to do this with a switch measure in the "Format your visual" panel under "Columns colors", but that did not seem to work.

 

Is this possible to do?

 

Thanks in advance! 

  • Hi Anonymous ,

     

    The switch statement is the way to go, but need a rank column to make it work. 

     

    This thread details a few ways to go about ranking: https://community.powerbi.com/t5/Desktop/Ranking-a-column-in-a-table/td-p/1436672 

     

    I followed the index column within power query and called it 'Descending Rank' and then used the following measures:

    Rank = SELECTEDVALUE('Top 3'[Descending Rank])

     

    Colouringtop3 = 
    var firstplace = [Rank] = 1
    var secondplace = [Rank] = 2
    var thirdplace = [Rank] = 3
    var result = SWITCH(
    TRUE(),
    firstplace, "Gold",
    secondplace, "Silver",
    thirdplace, "Brown", "Black")
    return
    result

     

    I hope this solves your problem and if it does please mark it as a solution!

     

1 Reply

  • Hi Anonymous ,

     

    The switch statement is the way to go, but need a rank column to make it work. 

     

    This thread details a few ways to go about ranking: https://community.powerbi.com/t5/Desktop/Ranking-a-column-in-a-table/td-p/1436672 

     

    I followed the index column within power query and called it 'Descending Rank' and then used the following measures:

    Rank = SELECTEDVALUE('Top 3'[Descending Rank])

     

    Colouringtop3 = 
    var firstplace = [Rank] = 1
    var secondplace = [Rank] = 2
    var thirdplace = [Rank] = 3
    var result = SWITCH(
    TRUE(),
    firstplace, "Gold",
    secondplace, "Silver",
    thirdplace, "Brown", "Black")
    return
    result

     

    I hope this solves your problem and if it does please mark it as a solution!