cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chicko29
Frequent Visitor

Greater than or equal operator for date difference in gallery

The greater than or equal operator for a date difference in gallery is not working

 

I have a custom gallery with a Label field named Days.

I put the following for the Text property which works : DateDiff(ThisItem.Date,Now()) 

I put the following for the color property which doesn't work: If(Days.value >= 5, Red, Green). I also tried If(Days.text >= "5", Red, Green)

 

What am I doing wrong? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @Chicko29

Because Days is a unit type that's associated with the DateAdd function, I would name your label LabelDays rather than Days.

https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

Once you do this, the following syntax should work:

If(Value(LabelDays.Text) >= "5", Red, Green)

 

View solution in original post

1 REPLY 1
timl
Super User
Super User

Hi @Chicko29

Because Days is a unit type that's associated with the DateAdd function, I would name your label LabelDays rather than Days.

https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

Once you do this, the following syntax should work:

If(Value(LabelDays.Text) >= "5", Red, Green)

 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,477)