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 / How to make this deleg...
Power Apps
Unanswered

How to make this delegable?

(1) ShareShare
ReportReport
Posted on by 6
I want a user to be able to select and apply multiple tags to a search. For example, if they choose tags "Software" and "Communications" the gallery should only show a list of items that have both the tags software AND communications. This is connected to dataverse. Tags is a multi‑select Choice column
 
With(
    {
        base: Search(
            Filter(
                TrainingModules,
                IsBlank(mediaTypeSearchBox.Selected) || MediaType = mediaTypeSearchBox.Selected.Value,
                'Avg Rating' >= varMin / 2 && 'Avg Rating' <= varMax / 2,
        // Note: Delegation Issue. More than 2k Training Modules will lead to search issues.
                IsEmpty(tagSearchBox.SelectedItems) || !(false in ForAll(
                    tagSearchBox.SelectedItems,
                    ThisRecord.Value in Tags.Value
                ))
            ),
            searchQuery,
            'Module Title',
            Description
        )
    },
//Apply the additional filters to the already searched list
    Switch(
        filteringResults.Selected.Value,
        "Newest",
        SortByColumns(
            base,
            "createdon",
            SortOrder.Descending
        ),
        "Top Rated",
        SortByColumns(
            base,
            "jsc_avgrating",
            SortOrder.Descending
        ),
        base
    )
)
I have the same question (0)
  • WarrenBelz Profile Picture
    154,918 Most Valuable Professional on at
    Try this for a start - I assume you are using SharePoint as a data source. Also not sure if the many-to-many filter will give you what you want - if you need anything that matches anything selected in the Combo Box, you need the below.
    With(
       {
          base: 
          Filter(
             TrainingModules,
             Len(mediaTypeSearchBox.Selected.Value) - 0 || MediaType = mediaTypeSearchBox.Selected.Value,
             'Avg Rating' >= varMin / 2 && 'Avg Rating' <= varMax / 2
          ),
          _Sort:
          Switch(
             filteringResults.Selected.Value,
             "Newest",
             "createdon",
             "Top Rated",
             "jsc_avgrating"
          )
       },
       Search(
          SortByColumns,
             Filter(
                base,
                IsEmpty(tagSearchBox.SelectedItems) || 
                true in 
                ForAll(
                   tagSearchBox.SelectedItems,
                   ThisRecord.Value in Tags.Value
                )
             ),
             _Sort,
             SortOrder.Descending
          ),
          searchQuery,
          'Module Title',
          Description
       )
    )
     
    Please ✅ Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • EG-03031724-0 Profile Picture
    6 on at
    I tried this. Which got rid of the delegation warning but is still non-delegable and did not resolve the issue. Also I am using Dataverse, ands tags is a multi-select choice column. 
     
    With(
       {
          base:
          Filter(
             TrainingModules,
             IsBlank(mediaTypeSearchBox.Selected) || MediaType = mediaTypeSearchBox.Selected.Value,
             'Avg Rating' >= varMin / 2 && 'Avg Rating' <= varMax / 2
          )
       },
       With({
        searched:
       Search(
             Filter(
                base,
                 IsEmpty(tagSearchBox.SelectedItems) ||
    CountIf(
             tagSearchBox.SelectedItems As s,
             !IsBlank( LookUp( Tags, Value = s.Value ) )
           )
           = CountRows(tagSearchBox.SelectedItems)
     
             ),
          searchQuery,
          'Module Title',
          Description
       )
    },
    Switch(
            filteringResults.Selected.Value,
            "Newest",
            SortByColumns(
                searched,
                "createdon",
                SortOrder.Descending
            ),
            "Top Rated",
            SortByColumns(
                searched,
                "jsc_avgrating",
                SortOrder.Descending
            ),
            searched
        )
    )
    )
  • WarrenBelz Profile Picture
    154,918 Most Valuable Professional on at
    I need to clarify what you mean by  is still non-delegable and did not resolve the issue
     
    If you are saying that it does not return the full data set required, then that is certainly possible as the structure I posted relies on the top filter on 'Avg Rating' returning record numbers under your (500 - 2,000) Data Row Limit
     
    Your problem is that many-to-many filters using either CountRows or CountIf and to some extent ForAll are all "local" functions are are not able to be Delegated by either SharePoint or Dataverse. The other issue is that With itself is a local variable - you can run anything Delegable inside it, but ultimately the output is limit to 2,000 records (so in effect a Delegation limitation) - although you can use it for "pre-defining" things you use on a Delegable filter.
     
    Before I look at this further (there may be scope for improvement now I know you are using Dataverse), what exactly (your desired result) are you trying to achieve with this
    CountIf(
       tagSearchBox.SelectedItems As s,
       !IsBlank( 
          LookUp( 
             Tags, 
             Value = s.Value 
          ) 
       )
    ) = CountRows(tagSearchBox.SelectedItems)
     
    Please ✅ Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • WarrenBelz Profile Picture
    154,918 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for. Happy to assist further if not.
     
    Please ✅ Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like â™¥
    Visit my blog
    Practical Power Apps    LinkedIn   
  • EG-03031724-0 Profile Picture
    6 on at
    Yes it does not return the full data set required. Going back to the original code:
     IsEmpty(tagSearchBox.SelectedItems) || !(false in ForAll(
                        tagSearchBox.SelectedItems,
                        ThisRecord.Value in Tags.Value
                    ))

    The desired result of this is to check if tags have been selected. If they have, then select all tags that apply. (it comes from a multi-choice column). I am thinking maybe of using power automate to fix the delegation issue but I have not found a good resource on this as of yet.
  • WarrenBelz Profile Picture
    154,918 Most Valuable Professional on at
    I know I am probably missing something here, but are you saying that if any tag is selected in the Combo Box the all tag values need to be selected from the Table or are you simply after any matching tags that have been selected. The original code
    CountIf(
       tagSearchBox.SelectedItems As s,
       !IsBlank( 
          LookUp( 
             Tags, 
             Value = s.Value 
          ) 
       )
    ) = CountRows(tagSearchBox.SelectedItems)
    suggests all need to be selected whereas your latest suggests the second option (which makes more sense to me)
    IsEmpty(tagSearchBox.SelectedItems) || 
    !(
       false in ForAll(
         tagSearchBox.SelectedItems,
         ThisRecord.Value in Tags.Value
       )
    )
    However, many-to-many filters are not supported by Delegation and also conditional sorts are not effectively Delegable, so you do have an issue here if you want all of this to be Delegable. Power Automate may be possible, depending on how many records you are watning to bring back, however expect some complex queries in there (and I am no expert at this process).
     
    Please ✅ Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard