cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Support
Community Support

Re: Nested IF statements to filter a data table

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
Highlighted
Super User
Super User

Re: Nested IF statements to filter a data table

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.

Highlighted
Community Support
Community Support

Re: Nested IF statements to filter a data table

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

Highlighted
Regular Visitor

Re: Nested IF statements to filter a data table

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (11,530)