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 / Filter on gallery not ...
Power Apps
Unanswered

Filter on gallery not working

(0) ShareShare
ReportReport
Posted on 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 !

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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.

  • Davs Profile Picture
    12 on at

    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.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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 at

    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.

     

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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 at

    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!

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard