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

Community site session details

Session Id : /eIW++dohOGmjSk3e2rId1
Power Apps - Building Power Apps
Answered

Filter on gallery not working

Like (0) ShareShare
ReportReport
Posted on 15 Mar 2022 14:45:15 by 12

Hello everyone,

 

I'm kinda new to Powerapps and I've been trying to filter a gallery according to some tutorials. So, im using a sharepoint list where theres a date field. When I tried to filter with DateDiff, where should only bring the last 7 days of records , it just doesnt bring anything. It worked before, but now its not working anymore. The formula im using is :

 

Filter(Responses_1;User = User().FullName; DateDiff(Reporting_Date;Today();Days) < 7)

 

 Where should bring only the records from the user who is consulting the app and the reporting_Date should be with 7 or less days. When I remove the DateDiff, it brings all the results from that user, and there I can see theres results from 13 and 14 of March and when I applied the DateDiff, these results dont show at all.

Am I doing something wrong and/or is there something wrong in my formula?

Thank you !

 

I have the same question (0)
  • Davs Profile Picture
    12 on 16 Mar 2022 at 08:38:00
    Re: Filter on gallery not working

    Hello @RandyHayes !

    Thank you ! When I changed the field to date type, it went all good! Now just need to change the format, since its in american way (mm/dd/yyyy) ! 

    Thank you for you help!

  • Verified answer
    RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 15 Mar 2022 at 15:38:55
    Re: Filter on gallery not working

    @Davs 

    I would suggest a Date type column and not a text column for this.

    Reason being, you will not be able to perform the greater-than on the text and get correct results, AND, using the DateValue in your formula like that will introduce delegation issues.

     

     

  • Davs Profile Picture
    12 on 15 Mar 2022 at 15:33:17
    Re: Filter on gallery not working

    In the datasource( sharepoint list) its set as "Single line of text" the field Im trying to filter! So, to work-around with your suggestion, I did a little change 

    With({_date: DateAdd(Today(); -7; Days)};
     Filter(Responses_1;
     User = User().FullName &&
     DateValue(Reporting_Date) >= _date )
    )

     

    And to be sure it was all good, I did this test that gives true when the condition is met:

    Davs_0-1647358353844.png

     

    Probably,  Im missing something, altought the image above shows that the validation should work for the filter.

     

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 15 Mar 2022 at 15:25:38
    Re: Filter on gallery not working

    @Davs 

    So, what is the datasource?

    It seems you have made changes then to the data types of the column in the datasource...have you forced a Refresh on the datasource in the designer?  This will be needed in order for it to get the changes.

  • Davs Profile Picture
    12 on 15 Mar 2022 at 15:15:31
    Re: Filter on gallery not working

    Hello @RandyHayes !
    Thank you for you suggestion!

    I've tried and im still not getting any data! I've forced the field to be DataValue ( to be sure its in a date value) and still dont get any data! I've added some results as you can check on the image attached! Its weird, because it was working a few days and now just doesnt work anymore! dont know if there was an update from powerapps that made this.

    In the image, it shows the data for the logged user without the date filter.

  • Verified answer
    RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 15 Mar 2022 at 14:52:27
    Re: Filter on gallery not working

    @Davs 

    In general, your formula should provide what you need.  However, you will run into delegation warnings with that formula, so consider changing to the following:

    With({_date: DateAdd(Today(); -7; Days},
     Filter(Responses_1;
     User = User().FullName &&
     Reporting_Date >= _date
     )
    )

     

    If you are still seeing nothing, then check your datasource and make sure you have exact matches on the full name and there are records with a date newer than 7 days ago.

    Keep in mind that matching the name has to be an exact match - letter case, spacing, etc.

     

    I hope this is helpful for you.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 982 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 396 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 356

Last 30 days Overall leaderboard
Loading started
Loading complete