Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Question regarding conditional formatting in Line clustered coloumn chart.

I have 2 different tables,

Table 1, with weight of the scrap in each month ,

Table 2, with total tonnage and target of each month.

For example, if my scrap total weight on Jan is X and tonnage of Jan is Y, then X/Y= Z%,

i would like to highlight the Z% value in Red if it is greater than Monthly Target else Green.

 

Table1

Weight of Scrap in Kg Week NumRef Month
108.211
9211
16.111
36.311
89.611
11011
42.211
49.211
421.411
6.211
811
90.411
4321
100.621
322.421
11021
63.921
466.931
22.331
27.631
42231
13.631
26.431
2.631
731
4.831
6.631
92.631
33.231
2831
38.831
44.431
83.131
14.231
21.731
1231
1231
10.631
113.231
18.231
68.231
21031
11131
262.241
1041
20041
112.841
28.241
5541
97.841
10841
20841
85.241
4041
2441
1441
11.841
2.241
10341

 

Table 2

MonthTonnage in KgYEARTarget
1137353520210.32%
2172726020210.35%
3207850520210.34%
4220556020210.31%
5143603520210.36%
6163731020210.34%
7176872020210.33%
8191214020210.33%
9191200020210.35%
10 20210.34%
11 20210.39%
12 20210.33%

 

  • Hi, Anonymous 

     

    According to your description, I think you need to establish the relationship between months first, then you can put the two table fields in one table visual, and create a measure to mark red by using conditional format.

    Like this:

    Measure =
    VAR a =
        SUMX (
            FILTER ( ALL ( Table1 ), [Ref Month] = SELECTEDVALUE ( Table2[Month] ) ),
            [Weight of Scrap in Kg ]
        )
    RETURN
        IF (
            DIVIDE ( a, SELECTEDVALUE ( Table2[Tonnage in Kg] ) )
                > SELECTEDVALUE ( Table2[Target] ),
            "Red"
        )
    

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please upload some insensitive data samples and expected output.


    Best Regards,

    Community Support Team _ Janey

2 Replies

  • Anonymous , I doubt clustered line visual if you are using only one measure on bar then you can use conditional formatting on bar. Not on line.

     

    You can a measure based conditional formatting

     

    example

     


    Color sales = if(AVERAGE(Sales[Sales Amount])<170,"green","red")

    Color Year = if(FIRSTNONBLANK('Table'[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK('Table'[Year],2014)>2018,"red","yellow"))

     

    Color = if(FIRSTNONBLANK('Table'[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170
    ,"lightgreen",if(FIRSTNONBLANK('Table'[Year],2014)>2018,"red","yellow"))

    Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

     

     

    refer if needed

    PowerBI Abstract Thesis: How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Community Support

    Hi, Anonymous 

     

    According to your description, I think you need to establish the relationship between months first, then you can put the two table fields in one table visual, and create a measure to mark red by using conditional format.

    Like this:

    Measure =
    VAR a =
        SUMX (
            FILTER ( ALL ( Table1 ), [Ref Month] = SELECTEDVALUE ( Table2[Month] ) ),
            [Weight of Scrap in Kg ]
        )
    RETURN
        IF (
            DIVIDE ( a, SELECTEDVALUE ( Table2[Tonnage in Kg] ) )
                > SELECTEDVALUE ( Table2[Target] ),
            "Red"
        )
    

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please upload some insensitive data samples and expected output.


    Best Regards,

    Community Support Team _ Janey