cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chris2
Regular Visitor

Nested IF statements to filter a data table

Hey all,

 

I am currently working on filtering a data table via two parameters. Anayst (I misspelled Analyst in source file) and Stock symbol. Anayst is populated via Dropdown2 and Stock Symbol is populated via ComboBox1.

The filter currently works if I have both an Analyst and a Stock symbol selected but not if only one or the other is selected.

 

My goal is to be able to filter by Analyst or stock symbol independently but also be able to filter by the combination of both (ie Analyst and stock symbol)

 

Below is the equation I'm using. 

If(IsBlank(Dropdown2.SelectedText.Result), Filter(Table1, 'Stock Symbol'= ComboBox1.Selected.'Stock Symbol'), If(IsEmpty(ComboBox1), Filter(Table1, Anayst= Dropdown2.SelectedText.Result), Filter(Table1, 'Stock Symbol'= ComboBox1.Selected.'Stock Symbol' && Anayst= Dropdown2.SelectedText.Result)))

 

Any help would be greatly appreciated. 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Chris2 ,

Do you want to filter your Data Table records based on any combination of the two filter conditions?

 

Based on the formula that you mentioned, I think it is complex. I have made a test on my side, please try the following formula (set the Items property of Data Table to following😞

Filter(
       Table1,
       If(
          IsBlank(Dropdown2.SelectedText.Result),
          true,
          Anayst= Dropdown2.SelectedText.Result
       ),
       If(
           IsBlank(ComboBox1.Selected.'Stock Symbol'),
           true,
           'Stock Symbol'= ComboBox1.Selected.'Stock Symbol' 
       )
)

Please take a try with above solution, hopes it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Chris2 ,

Try the below - I also have allowed for all records to be displayed if both  controls are blank

Filter(
   Table1, 
   If(
      IsBlank(Dropdown2.SelectedText.Result) && IsEmpty(ComboBox1),
      true,
      IsBlank(Dropdown2.SelectedText.Result), 
      'Stock Symbol'= ComboBox1.Selected.'Stock Symbol',
      IsEmpty(ComboBox1), 
      Anayst= Dropdown2.SelectedText.Result,
      'Stock Symbol'= ComboBox1.Selected.'Stock Symbol' && 
      Anayst= Dropdown2.SelectedText.Result
   )
)

 

Please click Accept as solution 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 giving it Thumbs Up.

v-xida-msft
Community Support
Community Support

Hi @Chris2 ,

Do you want to filter your Data Table records based on any combination of the two filter conditions?

 

Based on the formula that you mentioned, I think it is complex. I have made a test on my side, please try the following formula (set the Items property of Data Table to following😞

Filter(
       Table1,
       If(
          IsBlank(Dropdown2.SelectedText.Result),
          true,
          Anayst= Dropdown2.SelectedText.Result
       ),
       If(
           IsBlank(ComboBox1.Selected.'Stock Symbol'),
           true,
           'Stock Symbol'= ComboBox1.Selected.'Stock Symbol' 
       )
)

Please take a try with above solution, hopes it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

This was beneficial and better than mine. It worked correctly if both were selected or if just the combo box was selected. It did not allow me to filter on just the Anayst field however. 

 

Thank you!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,564)