Forum Discussion
Matrix-Conditional formating based on another field
| Employee | CategoryDesc | WorkDates | |||||||
| Employee | CategoryDesc | ColorCode | 2/2/2019 | 2/3/2019 | 2/4/2019 | 2/5/2019 | 2/6/2019 | 2/7/2019 | 2/8/2019 |
| Jane Dow | Labor-Daily | Lime | 8 | 8 | 8 | 8 | 10 | ||
| Jane Doe | Labor-Salary | Lime | 8 | 9 | 9 | ||||
| Jane Dow | Holiday | Black | 9 | 8 | 8 | ||||
| Jane Doe | Vacation | Orange | 8 | 8 | 10 |
Here is my example:
I added to this DAX formula, however, I cant get the weekends to turn yellow or where there is no value in work hours to turn pink.
7 Replies
- amitchandakSuper User
Add +0 to your work hour formula
Also, move weekday condition as the first condition in Switch
- AnonymousNot applicable
amitchandak When i move weeknumber condition to first condition in switch, everything changes to yellow. I dont know how to add the work hours to this switch.
- V-lianl-msftCommunity Support
Hi Anonymous ,
You can refer to this :https://community.powerbi.com/t5/Desktop/Conditional-color-formatting-on-Matrix-based-on-dimension-values/m-p/836471
If the problem persists,could you please share a PBIX file through cloud service like OneDrive.(Please mask any sensitive data before uploading)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
V-lianl-msft Sorry, this is not working for me, maybe something I am doing wrong .
I need to color code the background color for work hours based on the categorydesc field.
Labor - Daily - green
Labor - Hourly - green
Labor - Salary - green
Vacation - orange
Holiday - black
When the work hours are 0 or no value the color should be pink.
When the date falls on a weekend that entire column should be yellow regardless if hours are reported.
Please see my sample. I do not know how to save this in a clound service.
- V-lianl-msftCommunity Support
Hi Anonymous ,
Based on the sample data you provided, I get the result you expect.
Measure = SWITCH(TRUE(), WEEKDAY(MAX(Sheet1[weekdate]),2)in{6,7},"yellow", MAX(Sheet1[hours])=0||ISBLANK(MAX(Sheet1[hours])),"pink", MAX(Sheet1[categorydesc ])="Holiday","black", MAX(Sheet1[categorydesc ])="Vacation","orange", MAX(Sheet1[categorydesc ])="Labor - Daily","green", MAX(Sheet1[categorydesc ])="Labor - Hourly ","green", MAX(Sheet1[categorydesc ])="Labor - Salary","green", "white")Here is the sample pbix
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.