Forum Discussion
deb_power123
Helper V
5 years agoDAX to handle conditional formatting for column category
Hi All, I have a table named "LocationSchool " and another table "Weekcal" which are related via weeknumber as 1:n. Weekcal table contains weeknumber and weeknumber[total 53 weeks] with week pr...
Markus_Re
Resolver I
5 years agoHi deb_power123,
for your purpose i would switch from Matrix to a basic table. Just by changing the visual, PowerBI automatically created the table described above.
For formatting you could try this:
color =
var _sum = SUM(LocationSchool[seatsoccupied])
var _today = TODAY()
var _selecteddate = SELECTEDVALUE(LocationSchool[Date])
var _result =
IF(HASONEVALUE(LocationSchool[Date]),
IF(NOT(ISBLANK(_sum)) && _selecteddate = _today,
SWITCH(TRUE,
_sum <= 0.2, "red",
0.2 < _sum && _sum <= 0.65, "yellow",
0.65 < _sum, "green"), BLANK()), BLANK())
RETURN
_result
After creating the Measure you can use it in the visual options under "Conditional Formatting" -> "Font Color" (or whatever you want to change) -> "Advancend Controls" (If the window doesn´t open from itself) -> Change "Format by" to "Field value" -> under "Based on field" select your previously created (in this case "color") Measure
Hope this helps.
Best regards,
Markus
Did this answer your question? Mark my post as a solution!