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 / Filter a Datatable wit...
Power Apps
Answered

Filter a Datatable with 2 Conditions and an Variable

(0) ShareShare
ReportReport
Posted on by 4

Hello,

 

I try to filter a data table by two criteria and sort it after that. Basis of the table is a sharepoint list.

The following formula works:

 

Sort(Filter('Zeitdaten Mandanten';Bearbeiter = 'Office365-Benutzer'.MyProfile().Mail;'Datum und Uhrzeit'= DateValue1.SelectedDate);'Datum und Uhrzeit';SortOrder.Ascending)

 

The problem is delegation. Calling the Office365 user function makes it impossible as far as I have understood.

So I tried to swap the Ofice365 Email into a global variable, i call this function before i open the screen with the DataTable.

 

Set(VariableMail;'Office365-Benutzer'.MyProfile().Mail)

 

Unfortunately the following formula do not work :

 

Sort(Filter('Zeitdaten Mandanten';Bearbeiter= VariableMail;'Datum und Uhrzeit'= DatePicker1.SelectedDate);'Datum und Uhrzeit';SortOrder.Ascending)

 

The strange thing for me is, the first part:

 

Filter('Zeitdaten Mandanten';Bearbeiter=VariableMail)

 

works. But not in combination with the second condition (which i didn´t change). The second condition alone:

 

Filter('Zeitdaten Mandanten';'Datum und Uhrzeit'= DateValue1.SelectedDate)

 

Doesn't work either. This is where my understanding ends. Why does it work in combination with Office365 users, but not with the variable or alone?

 

Thanks a lot!

 

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Spuff 

    I believe the delegation issue is caused by this FILTER criteria

    'Datum und Uhrzeit'= DateValue1.SelectedDate

     

    Date columns are currently not delegable for SharePoint.  See the table below for a completing listing of delegation scenarios.

     

    sw.PNG

     

    Link to original MS Blog post

    https://powerapps.microsoft.com/en-us/blog/sharepoint-delegation-improvements/

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Spuff 

     

    What is the total number of records in your SP list? If this is less than 2000, you can update a setting below:
    App Settings -> Advanced Settings -> Data Row Limit for Non-Delegable queries -> Set this to 2000.

    Also, can you try to update the expression as:

    Sort(Filter(Filter('Zeitdaten Mandanten';Bearbeiter= VariableMail);'Datum und Uhrzeit'= DatePicker1.SelectedDate);'Datum und Uhrzeit';Ascending)

    If you have more than 2000 records, you can follow my blog where I have created an extra auto calculated column in my SP list and used a collection to get more than 2000 records in the local collection. You can refer: https://www.appliedis.com/how-to-use-galleries-in-powerapps/ 

    You can create a collection in a similar way I created the OrderCollection.

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • mdevaney Profile Picture
    29,991 Moderator on at

    @yashag2255 

    FYI, the URL in your link is slightly malformed.  Just wanted to notify you so it can be corrected.

  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @mdevaney 

     

    Thank you so much for the note. Here is the corrected URL (might have made some space mistake while adding the URL to the post so apologies for that)

     

    https://www.appliedis.com/how-to-use-galleries-in-powerapps/ 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard