Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
| 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.
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.
@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.
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.
@V-lianl-msft Here is my pbix file. All of the colors are not working.
when there are no hours the background should be pink. Also, it is only shading saturdays not sundays. please let me know if you can access the file, if not please send me an email address. Thanks a lot for your hel
Hi @Anonymous ,
Unfortunately, we are performing conditional formatting on "work hours" and can only judge when "work hours" has value.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 37 | |
| 35 | |
| 35 | |
| 28 |
| User | Count |
|---|---|
| 134 | |
| 101 | |
| 71 | |
| 67 | |
| 65 |