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
Anonymous
Not applicable

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%

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
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"
    )

vjaneygmsft_0-1633083268458.png

vjaneygmsft_1-1633083525151.png

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

View solution in original post

2 REPLIES 2
v-janeyg-msft
Community Support
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"
    )

vjaneygmsft_0-1633083268458.png

vjaneygmsft_1-1633083525151.png

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

amitchandak
Super User
Super User

@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

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.