Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Dynamic filter formula

Hi All, 


i wanted to know if there is a way to set a variable and then user it as a formula in a filter function?


Set(Vartest,Left(Concat(Country,"'Country Text Lookup' = "&""""&Title&""""& " Or "),Len(Concat(Country,Title & " Or "))-9))


then use the above in a filter 


Filter( SharepointList, Vartest)


something like the above. 

Super User
Super User

You would need a column in the list to compare it to, but you can use variables.

Filter( List, Vartest = ColumnName) 

You could use 'in" or another test. You could also use multiple tests in your filter instead of that complex variable.

It all depends on what data you are trying to find.

I made a little mistake there explaining what im trying to do. 


Set(Vartest,Left(Concat(Country,"'Country Text Lookup' = "&""""&ColumnName&""""& " Or "),Len(Concat(Country,Title & " Or "))-9)) = this formula collected all the country a user has access too, this is done when the user firsts log in. 


so if user is in 3 country the Vartest will have a value like this 'Country Text Lookup' = "UK" Or 'Country Text Lookup' = "USA" Or 'Country Text Lookup' = "Canada"


"Country Text Lookup" is a Column that exists within a  SharePoint List called ListABC 


so if i user Vartest in a filter function would it give me something like the below ?


Filter( ListABC , 'Country Text Lookup' = "UK" Or 'Country Text Lookup' = "USA" Or 'Country Text Lookup' = "Canada"

That Filter will only return the rows that 1 of those countries listed. I'm still not exactly sure what you are trying to accomplish. Are you trying to limit access to certain parts of the app depending on the country listed? Are the countries listed in the Country field, but you have multiple ones in the field?

How many countries are you dealing with? There may be better ways to accomplish this. 

exactly as you said,  im trying to limit the access to certain items within a gallery/app with this.


so there is two lists 

1) with country's and users who have access to that country 

2)  work orders and the country its in


in total there is about 100 country 


Helpful resources

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,501)