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 / If statement with betw...
Power Apps
Answered

If statement with between two date values is not working

(0) ShareShare
ReportReport
Posted on by 141

Hi Team - How can I correct this formula?

 

I am trying to state the following:

 

If "Gold" appears in the gallery, then return 2/28/2022 if not, return 5/30/2020 + 365 (days). 

Annasuela__0-1655907210407.png

 

I also tried another formula. That's not working either.  Please note, the box "Label5_18" is located outside the gallery. 

Annasuela__1-1655907264131.png

 

Would greatly appreciate your help!

 

Thank you so much! 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    Hi @Annasuela_ ,

    You need to test if there is any data in the lookup

    If(
     !IsBlank(
     LookUp(
     Gallery5.A111tems,
     AwardType = "Gold"
     ).AwardType
     ),
     'Date issued', 
     DateValue(Label5_18.Text) + 365
    )

     

    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

     

  • Annasuela_ Profile Picture
    141 on at

    @WarrenBelz Amazing again! 🙂 Can't thank you enough Warren. I hope you have an amazing day. 

  • Annasuela_ Profile Picture
    141 on at

    Hi @WarrenBelz  - I actually ran into a problem which I thought wasn't an issue. The "Date Issued" which in this case is: "field_7" field isn't being recognized by the formula. Do you know why this could happen? for some reason AwardType (Field_6) and Date issued (Field_7) titles disappeared, but I'll figure out why later. I just want the formula to work at the moment.  Thank you again! 

    Annasuela__0-1655994825403.png

     

      

    If(
     !IsBlank(
     LookUp(
     Gallery5.A111tems,
     AwardType = "Gold"
     ).AwardType
     ),
     'Date issued', 
     DateValue(Label5_18.Text) + 365
    )

     

  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    HI @Annasuela_ ,

    I cannot see your data, but you need to find the correct name of that field, also if the label is in a Gallery, you will need ThisItem.field_7. Where is the label situated ?

  • Annasuela_ Profile Picture
    141 on at

    Hi @WarrenBelz - I am not sure what happened to my fields when I updated the data, perhaps it affected the SharePoint titles. However, the formula remains the same: AwardType: field_6 & DateIssued: field_7. I'll fix that part when the entire formula works. 🙂 Thank you again for looking into this.  

    Annasuela__0-1656022100453.png

    Annasuela__1-1656022150564.png

     

     

     

  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    @Annasuela_ ,

    So this is fixed now ?

  • Annasuela_ Profile Picture
    141 on at

    Hi @WarrenBelz  - Unfortunately, it is not recognizing field_7 the way the formula is written. 

    Annasuela__0-1656024847273.png

     

  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    @Annasuela_ ,

    You simply have the refer to field_7 in the context of where the Label is situated - ThisItem.field_7 if in a Form or possibly Gallery5.Selected.field7

     

    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

  • Annasuela_ Profile Picture
    141 on at

    Hi @WarrenBelz - yay! It looks like we got at least one part of work 🙂 Gallery.Selected.field_7 worked.

     

    However, it looks like the formula is not returning anything on the label when it performs a lookup against "Bronze" award. I have a date value for the "Bronze" award and a date value on label5_18. Shouldn't the formula return one of the two?   

     

    Annasuela__0-1656029824911.png

     

  • Verified answer
    WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    Hi @Annasuela_ ,

    Yes, but you need to make sure when you are in Design mode that something has been selected in the gallery - put two labels on the screen

    Gallery5.Selected.field_7

    and

    DateValue(Label5_18.Text) + 365

    to ensure you have values in both.

     

    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

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard