Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
soupeco
New Member

Conditionally Filtering Out Rows based on 2 Parameters in w/ Power Query

Hello,
 

I have a table similar to the one attached below:

 
AcctNumCenterNumDepCodeBalance
1234541110122450
1234411101257200
49291804222257400
3801384048592224100

 

What I would like to do, using power query, is conditionally filter out (remove) rows where CenterNum = 1101 and DepCode = 257. I figured Table.SelectRows()  would work but it doesn't and the query just returns, this table is empty. The #"Expanded AccountLookup" ,in my formula below, is referencing the power query applied step before the one I am trying to create. I'm hoping to get some input on how to remove rows based on these two paramters.

= Table.SelectRows(#"Expanded AccountLookup", each [CenterNum] = "1111001" and [DepCode] = "257")

Thank you!

1 ACCEPTED SOLUTION
jennratten
Super User
Super User

You were really close.  If CenterNum and DepCode are formatted as text columns then you would include the quotation marks as you have in your script - otherwise you would not include the quotation marks, but you have a few extra digits.  Instead of "1101" you have "1111001".  The paranthesis in the snip below were automatically added by Power Query in desktop, but they are optional in this scenario.

jennratten_0-1654054337213.png

= Table.SelectRows(#"Changed Type", each ([CenterNum] = 1101) and ([DepCode] = 257))

 

 

View solution in original post

3 REPLIES 3
soupeco
New Member

Wow, thanks so much for the help!

You're very welcome!

jennratten
Super User
Super User

You were really close.  If CenterNum and DepCode are formatted as text columns then you would include the quotation marks as you have in your script - otherwise you would not include the quotation marks, but you have a few extra digits.  Instead of "1101" you have "1111001".  The paranthesis in the snip below were automatically added by Power Query in desktop, but they are optional in this scenario.

jennratten_0-1654054337213.png

= Table.SelectRows(#"Changed Type", each ([CenterNum] = 1101) and ([DepCode] = 257))

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors