The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
helpDear Experts,
I have been struggling for a long time to solve my problem, and I haven't found a solution yet.
I have delivery company data that includes zones and the following key indicators:
I want to color the three indicators in green and red based on achieving the target or not, noting that the target for each zone is different.
In Zone A:
In Zone B:
In Zone C:
I kindly request your assistance in solving this problem and dynamically applying the coloring based on the specified conditions for each zone.
Thank you in advance for your cooperation.
Attached Data as example:
Zones | total order time | vendor Acceptance time | arrival at customer time |
A | 37 | 4 | 24 |
B | 38 | 5 | 27 |
B | 22 | 5 | 28 |
C | 27 | 2 | 23 |
A | 26 | 2 | 10 |
A | 40 | 1 | 14 |
C | 28 | 4 | 12 |
C | 31 | 3 | 27 |
A | 17 | 1 | 25 |
B | 39 | 2 | 10 |
B | 22 | 4 | 29 |
C | 33 | 3 | 19 |
A | 23 | 7 | 17 |
A | 16 | 2 | 25 |
C | 32 | 7 | 15 |
C | 39 | 1 | 25 |
A | 33 | 4 | 16 |
A | 22 | 1 | 12 |
C | 36 | 3 | 29 |
C | 32 | 7 | 18 |
A | 29 | 3 | 29 |
B | 38 | 2 | 16 |
B | 36 | 5 | 29 |
C | 31 | 1 | 11 |
A | 40 | 7 | 26 |
Solved! Go to Solution.
hello @majid154a
please check if this accomodate your need.
1. Create a measure for 'total order time' conditional formating.
2. Create a measure for 'vendor acceptance time' conditional formating.
3. Create a measure for 'arrival at customer time' conditional formating.
4. Plot your data, hit that arrow in 'total order time' Columns value, select Conditional Formatting, then pick conditional formatting you want (background or font color). I picked background color in this case.
5. Hit Format Style and choose Field Value
6. Choose your table, then select the 'Order Colot Palette" measure that previously made for 'total order time'. then OK.
7. Do exact same way for 'vendor acceptance time' and 'arrival at customer time'.
You have to make sure to select vendor color measure for 'vendor acceptance time' and customer color measure for 'arrival at customer time'.
Hope this will help you.
Thank you.
hello @majid154a
glad to be a help.
select icon if you want to have icon conditional formating.
1. Change the color code into number. This is for measure average total order, do exact same way for measure average vendor acceptance time and measure average arrival at customer time.
3. Choose Rules in Format Style, then select the measure you are working on (I used average total order for this example).
Icon layout is for icon position.
- Make sure to change "If Value" into equal then put your measure number. For example: in measure average total order time, I used 1 if Zone A and Average Total Order Time less than 35.
- Make sure to change into Number (dont use Percent).
- Select your preferences icons.
Do this for vendor acceptance time and arrival at customer time.
Hope this will help you.
Thank you.
hello @majid154a
please check if this accomodate your need.
1. Create a measure for 'total order time' conditional formating.
2. Create a measure for 'vendor acceptance time' conditional formating.
3. Create a measure for 'arrival at customer time' conditional formating.
4. Plot your data, hit that arrow in 'total order time' Columns value, select Conditional Formatting, then pick conditional formatting you want (background or font color). I picked background color in this case.
5. Hit Format Style and choose Field Value
6. Choose your table, then select the 'Order Colot Palette" measure that previously made for 'total order time'. then OK.
7. Do exact same way for 'vendor acceptance time' and 'arrival at customer time'.
You have to make sure to select vendor color measure for 'vendor acceptance time' and customer color measure for 'arrival at customer time'.
Hope this will help you.
Thank you.
Hi @Irwan
I tested this code, and it showed me color codes instead of numbers.
I have attached the code used for your reference.
Hello @majid154a
following my post replying your question above, you place your column into matrix column value not those measures you made.
These measures are used to assign color based on average value of your column ('total order time', 'vendor acceptance time', and 'arrival at customer time'). So do not place those measure for your matrix column value.
1. you place your column value in matrix visual as below image (use average value).
2. hit that down arrow to assign color based on measures you made before.
3. select Field Value in Format Style and choose the measure based on the column you are working on.
for example, I tried to assign color to 'total order time' and so i choose measure 'Order Color Palette' because 'Order Color Palette' has conditional if color for 'total order time'
4. and do exact same way for 'vendor acceptance time' and 'arrival at customer time'.
Hope this will help you.
Thank you.
Thank you @Irwan very much for your kind help.
You used SELECTEDVALUE in the three measures because it is applied to a column. How can I then convert it to the average for each of the three measures, as the requirement is for the average, as I mentioned in the question?
Also, zones should appear only once for each zone (don't summarize). The numbers will change based on the slicers available.
Also, can I use icons instead of backgrounds?
I greatly appreciate your assistance and am grateful for your cooperation.
Is it possible to send the file in which you solved the example?
Thank you again.
Hello @majid154a ,
those measures are used for defining color based on conditional if.
Yes, you can choose many option for conditional formating.
Ah sorry, I misunderstood your goal.
Here is the update. I have changed into matrix visual so zones are appear only once.
Here is the DAX for measure to assign average value :
Change column value into average (default is sum). and do this for all your column value ('total order time', 'vendor acceptance time', and 'arrival at customer time')
Please check this link for pbix download.
Hope this will help you.
Thank you.
hello @majid154a
glad to be a help.
select icon if you want to have icon conditional formating.
1. Change the color code into number. This is for measure average total order, do exact same way for measure average vendor acceptance time and measure average arrival at customer time.
3. Choose Rules in Format Style, then select the measure you are working on (I used average total order for this example).
Icon layout is for icon position.
- Make sure to change "If Value" into equal then put your measure number. For example: in measure average total order time, I used 1 if Zone A and Average Total Order Time less than 35.
- Make sure to change into Number (dont use Percent).
- Select your preferences icons.
Do this for vendor acceptance time and arrival at customer time.
Hope this will help you.
Thank you.
Thank you @Irwan , my dear brother, for helping me with the solution. I applied your solution, and it works correctly.
Thank you a hundred times
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |