Hi All,
I would like to change a label colour based on a date value, could anyone guide me please?
As an example, a member of staff has a review booked for the 20/1/22
20 Days & Over the date above, the label wants to be green.
Less than 20 days to go from the above date, the label wants to change orange
On the 20/1/22 and beyond, the label wants to turn red.
I was experimenting with DateDiff but couldn't get it right.
However If we have marked the review as being complete "Yes" then the label wants to turn to light green.
The Yes/No is a choice field.
Solved! Go to Solution.
Hi @AdamH ,
That is because it is a yes/no field - I actually had a debate with myself whether to post the below first, but you described the input as "Yes", which infers Text. You are also missing a comma at the top.
With(
{
wDays:
DateDiff(
Today(),
'6 Month NQP Review Date',
Days
)
},
If(
ThisItem.'6 Month NQP Review Completed',
LightGreen,
wDays >= 20,
Green,
wDays >= 0,
Orange,
Red
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @AdamH ,
Something like this
With(
{
wDays:
DateDiff(
Today(),
ReviewDateField,
Days
)
},
If(
ReviewCompletedField = "Yes"
LightGreen,
wDays >= 20,
Green,
wDays >= 0,
Orange,
Red
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @AdamH ,
That is because it is a yes/no field - I actually had a debate with myself whether to post the below first, but you described the input as "Yes", which infers Text. You are also missing a comma at the top.
With(
{
wDays:
DateDiff(
Today(),
'6 Month NQP Review Date',
Days
)
},
If(
ThisItem.'6 Month NQP Review Completed',
LightGreen,
wDays >= 20,
Green,
wDays >= 0,
Orange,
Red
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
@AdamH , the code posted by @WarrenBelz is correct. You are supposed to use a date-time value
@WarrenBelz
Thanks for that guide. I modified a little by placing .Value="Yes"
With(
{
wDays:
DateDiff(
Today(),
ThisItem.'6 Month NQP Review Date',
Days
)
},
If(
ThisItem.'6 Month NQP Review Completed?'.Value="Yes",
LightGreen,
wDays >= 20,
Green,
wDays >= 0,
Orange,
Red
)
)
Hi @AdamH ,
So it was a Choice column - I actually see that now right at the bottom of your post.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
188 | |
70 | |
50 | |
37 | |
25 |
User | Count |
---|---|
242 | |
112 | |
91 | |
91 | |
68 |