Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello!
I need help in using conditional formatting for dates.
I have a column for due dates and would want a color coded value when it's far from due date, almost due date and beyond due date.
For example.
I want Task Number and Due date background turned GREEN if it's far from it's due date.
ORANGE if it's close to its due date and
RED if it's beyond its due date.
Solved! Go to Solution.
Hi @swaggerboy69 ,
This is a measure and you should replace the ";" by ",".
CondittionalFormatting =
VAR number_of_days =
SELECTEDVALUE ( 'Table'[Due Date] ) - TODAY ()
RETURN
SWITCH (
TRUE (),
number_of_days < 0, "Red",
number_of_days < 10, "Orange",
"Green"
)
The number_of_days is a variable is calculated on top as you can see tha make the difference between the due date and today.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @swaggerboy69 ,
What is the condition to have it Close/Far from due date?
If you create a measure similar to the one below you can have the desired result:
CondittionalFormatting =
VAR number_of_days =
SELECTEDVALUE ( 'Table'[Due Date] ) - TODAY ()
RETURN
SWITCH (
TRUE ();
number_of_days < 0; "Red";
number_of_days < 10; "Orange";
"Green"
)
Just adjust the 10 days to whatever value you need then use it as your condittional formatting:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHello! Thank you for your response.
Should I just add a measure?
Where do I get number_of_days?
I get red lines. Sorry I'm, not too good with codes.
Hi @swaggerboy69 ,
This is a measure and you should replace the ";" by ",".
CondittionalFormatting =
VAR number_of_days =
SELECTEDVALUE ( 'Table'[Due Date] ) - TODAY ()
RETURN
SWITCH (
TRUE (),
number_of_days < 0, "Red",
number_of_days < 10, "Orange",
"Green"
)
The number_of_days is a variable is calculated on top as you can see tha make the difference between the due date and today.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsGreat. That worked. However how do I apply it to the table visual?
I only get the words.
Hi @swaggerboy69 ,
You need to select the dates and task number and all the columns you need then slected the condittional formatting and aplly the value of the measure see images below:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks Miguel! It worked!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |