Forum Discussion
Conditional formatting Dax
Dears,
I hope you all are doing well,
i want to write DAX to make conditional formatting for the "fuel last date" column in this visual table.
to display in red color if they exceed the number in the "Max per day" column and green if they do not exceed.
please note that: Fuel last Date is a measure and Max per day is a calculated column.
Expected result all numbers above 400 are displayed in red and those under 400 in green.
Thanks
7 Replies
- some_bihCommunity Champion
Hi mhablas426 try measure definition below (save your work before)
Fuel last Date =
VAR __max_date=MAX('F Dim Date'[Date])
RETURN
CALCULATE(
[Fuel Total Quantity],
FILTER('F Dim Date','F Dim Date'[Date] = __max_date))- mhablas426Advocate II
Hi some_bih
I've been using your DAX formula instead of mine. Would you mind explaining the differences between the two.but my main concern is about applying conditional formatting for this visual table could you please advise
- some_bihCommunity Champion
Hi mhablas426 at moment when I saw your measure I understand that you want to filter max date so I rewrite your measure.
- FreemanZSuper User
hi some_bih ,
try to apply conditional formating with a measure like:
Fuel last Date color=
IF(
CALCULATE(
[Fuel Total Quantity],
FILTER(
'F Dim Date',
'F Dim Date'[Date] = MAX('F Dim Date'[Date])
)
) > MAX(data[Max per day]),
"red", "green"
)
more about conditional formatting:
https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting
- mhablas426Advocate II
Dear FreemanZ
Thanks for replyFuel last Date color =IF (CALCULATE ([Fuel Total Quantity],FILTER ( 'F Dim Date', 'F Dim Date'[Date] = MAX ( 'F Dim Date'[Date] ) ))> MAX ( 'BI Fuel Issue'[Max per Day] ),"red","green")
I tried to use it, but I can't select it. How can I resolve this, or what could be the issue?
Kindly see the snapshot
Thanks,- FreemanZSuper User