web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem comparing Dates
Power Apps
Answered

Problem comparing Dates

(0) ShareShare
ReportReport
Posted on by 293

Hi! I'm using an app to know if I have an appointment on my calendar.

 

I used a gallery to get all the appointments and I'm even able to filter them by month and location wich is great.

 

Now the problem starts when I try to compare dates.

 

Ideally I have X amount of squares that set their fill color to red or green if I have the day free or not.

So I used this:

If(DateValue("5/" & Meses.SelectedText.Value & "/2019") in Concat(Gallery2.AllItems.Label3;Text(Label3);", ") ;Red ;Green )

The thing is, I had to use text since I need to have ALL the dates of X month and X location concatenated in a single record to be able to compare. The problem is that 5/10/2019 is in 15/10/2019 so it gives me a "false" true result.

 

If I try to use date values and not text I won't work either since I'm using the start property of the appointment to compare to a date and the start one has hours,minutes and seconds wich doesn't match with the manual date I put in. 

 

If I would be able to make text compare char by char I think that it will work, or if I'm able to save dates without time stamps.

 

Categories:
I have the same question (0)
  • cds Profile Picture
    1,001 on at

    try exactin

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @FacundoGorla ,

    Could you please share a bit more about your scenario?

     

    Based on the needs that you mentioned, I afraid that the date text string value could not achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

    If(
    DateValue("5/" & Meses.SelectedText.Value & "/2019") in ForAll(Gallery2.AllItems; DateValue(Label3.Text)); /* <-- date value comparison */
    Red;
    Green
    )

    Please consider take a try with above solution, then check if the issue is solved.

     

    More details about the ForAll function, please check the following article:

    ForAll function

     

    Best regards,

  • FacundoGorla Profile Picture
    293 on at

    Thanks for the reply. I already tried with exactin with no luck, then read that the only difference between exactin and in is that the first checks for caps in letters. So no use here.

     

    Tried ForAll since is the closest thing to a foreach we have, will try again with your code and let you know what happens.

     

    Plz tell me what else you need to know about the scenario.

  • FacundoGorla Profile Picture
    293 on at

    OMG IT WORKED! Thank you so much! know ti checks the values one by one. 

    Tried using ForAll before but I see it as a way to change column values.

    Will use it more often thanks to your example.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard