Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I have a list of Due Dates in a column 'AP Report (2)'[Due Date]
I need to colour these based on the following=
If date has passed or due in the next 7 days = red
Date 2 weeks to 1 month = Orange
Date > 1 month = Green
Would anyone be able to advise me how to acheive this?
Solved! Go to Solution.
Create a measure
Color =
VAR _due_date =
SELECTEDVALUE ( 'AP Report (2)'[Due Date] )
VAR _days =
DATEDIFF ( TODAY (), _due_date, DAY )
VAR _result =
SWITCH ( TRUE (), _days < 7, "Red", _days < 30, "Orange", "Green" )
RETURN
_result
Then use this measure in conditional formatting. (Format style by Field value).
Create a measure
Color =
VAR _due_date =
SELECTEDVALUE ( 'AP Report (2)'[Due Date] )
VAR _days =
DATEDIFF ( TODAY (), _due_date, DAY )
VAR _result =
SWITCH ( TRUE (), _days < 7, "Red", _days < 30, "Orange", "Green" )
RETURN
_result
Then use this measure in conditional formatting. (Format style by Field value).
Should that be _days in the switch statement instead of _due_date?
@kleigh wrote:Should that be _days in the switch statement instead of _due_date?
That was it, fixed now 🙂
This is giving me everything as a Green status
16th August should be Red?
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 |
---|---|
78 | |
76 | |
53 | |
37 | |
31 |
User | Count |
---|---|
101 | |
56 | |
51 | |
45 | |
40 |