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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Complex If Statement w...
Power Apps
Unanswered

Complex If Statement with Filters

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I am trying to show some data in a gallery based on the name of the user, the role of the user, and if the event date is today.

 

I can get these to work separately but I can't get them to work together. This one will only show me items based on the user's permissions (event lead or event coordinator) but I can't get it to filter by date. 

 

If(varName.'Event Lead' = 'Event Lead (Event Memo Users)'.Yes, 'Event Memos',Filter('Event Memos','Event Coordinator Name' = varName.Name))

 

This one will filter the date to only show today's events, which I want in addition to the items above. 

Filter('Event Memos', IsToday('Start Date and Time'))

 

Can I get some help with this?

 

Thanks

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @Anonymous ,

    Yes date filters with equals are tricky - try the below

    If(
     varName.'Event Lead' = 'Event Lead (Event Memo Users)'.Yes, 
     'Event Memos',
     Filter(
     'Event Memos',
     'Event Coordinator Name' = varName.Name &&
     DateDiff(
     'Start Date and Time',
     Today(),
     Days
     )=0
     )
    )

     

    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.

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz 

    Thanks for the help. I got it to work half way. It worked when the person logged in was an event coordinator because that's what the if statement said. The issue though is if an event lead logs in they still see everything. 
    I moved the filter in front and at the end but the ; was giving me an error that it wasn't the expected operator. 

     

    I event tried the original date filter I had and it still gave me the same error. I have no idea why it's doing that.

     

    Filter('Event Memos',DateDiff('Start Date and Time',Today(),Days)=0);
    If(
    varName.'Event Lead' = 'Event Lead (Event Memo Users)'.Yes,
    'Event Memos',
    Filter('Event Memos',
    'Event Coordinator Name' = varName.Name ))

     

    Thoughts?

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @Anonymous ,

    Try this (free-typed so watch commas/brackets)

    Filter(
     'Event Memos',
     DateDiff(
     'Start Date and Time',
     Today(),
     Days
     )=0
     &&
     If(
     varName.'Event Lead' <> 'Event Lead (Event Memo Users)'.Yes,
     'Event Coordinator Name' = varName.Name 
     )
    )

     

    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.

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @Anonymous ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

     

    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.

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz sorry not been able to try it yet. Projects have been shifted to what happens when we reopen. I will keep posting as I work on things. 

     

    Thanks

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz I just tried it and if I login as the Event Coordinator the event shows up correctly. However if I login as the Lead it doesn't show anything. 

    What am I missing?

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    OK @Anonymous ,

    Before I start looking into the logic of your data structure, try this

    Filter(
     'Event Memos',
     If(
     varName.'Event Lead' = 'Event Lead (Event Memo Users)'.Yes,
     DateDiff(
     'Start Date and Time',
     Today(),
     Days
     )=0 &&
     Event Coordinator Name' = varName.Name,
     DateDiff(
     'Start Date and Time',
     Today(),
     Days
     )=0
     )
    )

     

    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.

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    Hi @Anonymous ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

     

    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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard