Forum Discussion

nachobarr2020's avatar
nachobarr2020
Regular Visitor
2 years ago
Solved

Format bar colours in small multiples based on a condition

Hello community

 

I hope you are doing well. I come with a question. I have a graph which shows the count of people by nationality and it is splitted up using small multiples as shown in the picture example.

 

 

I have a table with these columns (GID is the ID and Date is a Text, is not a real date):

 

GIDNationalityDate
abc1AlbanianSeptember 2023
abc2TurkishOctober 2020

 

I would like to have the graph at the bottom columns so that the colors from the later time (September 2023), are shown in either green if there are more people than october (the prior date) or red if they are less people. What condition should I put into the formatting of the small multiples? I want to keep the small multiples graph

 

Thank you

  • Hi, nachobarr2020 

     

    You can try the following methods.
    sample data:

    October 2020 = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Country]=SELECTEDVALUE('Table'[Country])&&[Date]="October 2020"))
    September 2023 = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Country]=SELECTEDVALUE('Table'[Country])&&[Date]="September 2023"))
    Color Measure = IF([September 2023]>=[October 2020],"Green","Red")

    Please see the attached document.

     

    Best Regards,

    Community Support Team _Charlotte

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

1 Reply

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, nachobarr2020 

     

    You can try the following methods.
    sample data:

    October 2020 = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Country]=SELECTEDVALUE('Table'[Country])&&[Date]="October 2020"))
    September 2023 = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Country]=SELECTEDVALUE('Table'[Country])&&[Date]="September 2023"))
    Color Measure = IF([September 2023]>=[October 2020],"Green","Red")

    Please see the attached document.

     

    Best Regards,

    Community Support Team _Charlotte

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