Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
For DAX calculations, could you please advice how I can calc a column to show number of days it takes for close an issue if I have an initial date and due date. When it approaches 5 days to the due date, the shows a red color, 15 days to due date yellow, 30 days to due date should be green
Solved! Go to Solution.
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
)
@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.
Proud to be a Super User! |
|
Thank you so much. This really helped.
@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.
Proud to be a Super User! |
|
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
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
68 | |
57 | |
55 | |
36 | |
34 |
User | Count |
---|---|
76 | |
73 | |
48 | |
45 | |
43 |