Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
majid154a
Frequent Visitor

formatting color of measure

Dear Experts, 
in delivery data, having A, B, C & D zones, and total order time measure.
need formate color of total of order tiime based on target which are different for each zone as bellow. 

Targers of zones:
A <= 35 minutes

B<= 30 Mintues

C<= 55 mintues

D <= 40 mintues

if acheived put green, if not put red, 

How do that  in Power BI. I prefer to do example in power bi

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@majid154a 

 

I'm not sure if your data is in this form:

vfenlingmsft_0-1721872522744.png


If it is, you can refer to this method to achieve your needs.


Create a Measure for labeling the total order time for each Zone:

 

Average total order time =
CALCULATE (
    AVERAGE( 'Table02'[Order_time] ),
    FILTER ( ALL ( Table02 ), 'Table02'[Zones] = MAX ( 'Table02'[Zones] ) )
)

 


Create another Measure to determine if the target value is reached:

 

Color_change =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( Table02[Zones] ) = "A"
        && [Average total order time] <= 35, 1,
    SELECTEDVALUE ( Table02[Zones] ) = "B"
        && [Average total order time] <= 30, 1,
    SELECTEDVALUE ( Table02[Zones] ) = "C"
        && [Average total order time] <= 55, 1,
    SELECTEDVALUE ( Table02[Zones] ) = "D"
        && [Average total order time] <= 40, 1,
    0
)

 


Finally a background color rule is used to fill in the corresponding results:

vfenlingmsft_1-1721123849732.png

vfenlingmsft_2-1721123874276.png

vfenlingmsft_3-1721123894777.png

Result :

vfenlingmsft_1-1721872605482.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
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

3 REPLIES 3
Anonymous
Not applicable

Hi,@majid154a 

I am glad to help you. 

 

According to your description, you want to formatting color of measure? 

If I understand you correctly, then you can refer to my solution. 

 

First I simply created some data based on what you meant: 

vfenlingmsft_0-1720580438086.png

 

 

Then for the four zones A,B,C,D created the corresponding four Measures to calculate their Tatol order time: 

Total order time of A = SUM('Table'[A]) 

Total order time of B = SUM('Table'[B]) 

Total order time of C = SUM('Table'[C]) 

Total order time of D = SUM('Table'[D]) 

 

Then you can directly go to 'Format you visual' to format color, as shown below: 

vfenlingmsft_1-1720580438089.png

 

 

Set your rules for formatting color of measure over here. 

 

vfenlingmsft_2-1720580459546.png

 

 

You can set the color rules for the different Measures directly from this side and then repeat the above steps. 

vfenlingmsft_3-1720580459551.png

 

The final result: 

vfenlingmsft_4-1720580474502.png

 

This is just a simple example, hope it helps you. 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.


Best Regards,
Fen Ling,


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

Thank you very much for your cooperation, sacrifice, and detailed explanation, which reflects your high morals.

The solution you provided is correct, but I need to work on each area individually, and I have many areas.

The idea is that I want to work with the zones and the average order time in table chart, and the colors of the average order time should change according to the target for each aree

attached is an example and how we do like that: 

majid154a_0-1720590020247.png

 

Anonymous
Not applicable

Hi,@majid154a 

 

I'm not sure if your data is in this form:

vfenlingmsft_0-1721872522744.png


If it is, you can refer to this method to achieve your needs.


Create a Measure for labeling the total order time for each Zone:

 

Average total order time =
CALCULATE (
    AVERAGE( 'Table02'[Order_time] ),
    FILTER ( ALL ( Table02 ), 'Table02'[Zones] = MAX ( 'Table02'[Zones] ) )
)

 


Create another Measure to determine if the target value is reached:

 

Color_change =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( Table02[Zones] ) = "A"
        && [Average total order time] <= 35, 1,
    SELECTEDVALUE ( Table02[Zones] ) = "B"
        && [Average total order time] <= 30, 1,
    SELECTEDVALUE ( Table02[Zones] ) = "C"
        && [Average total order time] <= 55, 1,
    SELECTEDVALUE ( Table02[Zones] ) = "D"
        && [Average total order time] <= 40, 1,
    0
)

 


Finally a background color rule is used to fill in the corresponding results:

vfenlingmsft_1-1721123849732.png

vfenlingmsft_2-1721123874276.png

vfenlingmsft_3-1721123894777.png

Result :

vfenlingmsft_1-1721872605482.png

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.