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 / How to use Or operator...
Power Apps
Answered

How to use Or operator in filtering

(0) ShareShare
ReportReport
Posted on by

Hi, i need to use the or operator in this case...

 

I have a SP list with 4 column.

Regionold; regionold2; regionold3; region

 

Region is like a state. I need to filter the user region actually in use with the new region. 

For that, 

 

1. I Check the region of the user with office365user

2- if he lives in regionold, print the value in region; if he lives in region2 print region, if he lives in region3 print region.

 

To test that i add a combobow with this formula

 

'Utilisateursd''Office365'.SearchUser({searchTerm:ComboBox1.SearchText;top:100}).Mail

 

then i add a dropdown control and i add ths formula

 

Filter(Base_region_centre_update; Region_Old Or Region_Old2 Or Region_Old3='Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName).Region

 

but it's not working. If i tried to filter with only Region_old it's working. 

 

My sp looks like this

 

ALP1_0-1633352231975.png

 

the attribut compagnyname is where are stored the user region in our AAD

 

I use this formula to check this

 

'Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName

 

 

 

Can you help me. What am i missing ?

Thanks

 

 

Categories:
I have the same question (0)
  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    Each condition in the filter needs to return true or false  on its own - a column name alone does not do that. Try this version, using a With() to avoid a lot of repetition of code:

    With({ aRegion: 'Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName.Region};
    Filter(Base_region_centre_update; aRegion = Region_Old || aRegion = Region_Old2 || aRegion = Region_Old3 || aRegion = Region)
    )

    I prefer to use the || notation to denote OR. This filter returns any records that have the user's region in any of those four columns. I wasn't sure how that fit into the dropdown or combobox you mentioned, but this should get you started.

     

    Bryan

     

  • Community Power Platform Member Profile Picture
    on at

    Wahouu i'm so impressed. I didn't knew With function. It's powerful. I watched a video from shane young to learn more.

     

    I modified the formula like this

     

    With({aRegion:'Utilisateursd''Office365'.UserProfileV2(ComboBox1.Selected.Mail).companyName};Filter(Base_region_centre_update;aRegion=Region_Old||aRegion=Region_Old2||aRegion=Region_Old3||aRegion=Region))

     

    You forgot to remove .region after compagnyname.

    It works like a charm. Thank a lot

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard