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.

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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,700)