Forum Discussion
Filter out row using Table.SelectRows and conditional if/and
- 7 years ago
Hi Anonymous
You can try the below.
= Table.SelectRows(#"Changed Type", each not ( ( [Indicator] = "bob" and [Total] = 26 ) or ( [Indicator] = "jane" and [Total] = 21 ) or ( [Indicator] = "jon" and [Total] = 15 ) ) )Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Hi Anonymous
You can filter to Bob and 26 and add not like below.
= Table.SelectRows(#"Changed Type", each not ([Indicator] = "bob" and [Total] = 26))
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
- Anonymous7 years agoNot applicable
Thanks a lot Mariusz ,
each not() was exactly what I needed.
I also figured I could add an Index column and then filter out that unique ID.
Cheers, Roger
- Anonymous7 years agoNot applicable
Hi, can I ask a further question on this,
How can I adjust the code so that this code:
= Table.SelectRows(#"Changed Type", each not ([Indicator] = "bob" and [Total] = 26))
= Table.SelectRows(#"Changed Type", each not ([Indicator] = "jane" and [Total] = 21))
= Table.SelectRows(#"Changed Type", each not ([Indicator] = "jon" and [Total] = 15))is wrapped in something like a
each [indicator]
each if then
else if then
elseSo I dont have to keep writing '= Table.SelectRows(#' ?
Thanks, Roger
- Mariusz7 years agoCommunity Champion
Hi Anonymous
You can try the below.
= Table.SelectRows(#"Changed Type", each not ( ( [Indicator] = "bob" and [Total] = 26 ) or ( [Indicator] = "jane" and [Total] = 21 ) or ( [Indicator] = "jon" and [Total] = 15 ) ) )Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
- Anonymous4 years agoNot applicable
Hi Mariusz,
What code would you use if within [Indicator] column the rows had a nested List or Table and you wanted to 'select' only the rows had items in the List. For example [Indicator] contained "Bob" and "Sally" as rows in either the nested List or nested Table?
- Yondice3 years agoAdvocate I
This solved my problem.
Side lesson learned: if you're renaming columns, don't use parentheses or brackets in the new name. It will screw with subsequent transformation steps.