Forum Discussion
DAX Dates Remaining
- 1 year ago
Adjust the hex codes to the colours you like then apply this measure as condition formatting rule
Measure=
Var diff = Datediff( table[due date], today(), day)
Var green = "#aaaaaa"
Var yellow = "#aaaaaa"
Var red = "#aaaaaa"
Return
Switch(
True,
Diff <= 5, red,
Diff <= 15, yellow,
Diff <=30, green
)
- 1 year ago
AndrewKalungi You can create a calculated column to determine the number of days between the initial date and the due date.
DaysToClose = DATEDIFF([InitialDate], [DueDate], DAY)
You can use a calculated column to determine the color based on the number of days remaining until the due date.
DueDateColor =
SWITCH(
TRUE(),
[DaysToClose] <= 5, "Red",
[DaysToClose] <= 15, "Yellow",
[DaysToClose] <= 30, "Green",
"No Color"
)Go to the visualization where you want to apply the conditional formatting.
Select the field you want to format.
Choose "Conditional Formatting" and select "Background Color" or "Font Color".
Use the DueDateColor column to set the color rules.
Adjust the hex codes to the colours you like then apply this measure as condition formatting rule
Measure=
Var diff = Datediff( table[due date], today(), day)
Var green = "#aaaaaa"
Var yellow = "#aaaaaa"
Var red = "#aaaaaa"
Return
Switch(
True,
Diff <= 5, red,
Diff <= 15, yellow,
Diff <=30, green
)