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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
tgjones43
Helper IV
Helper IV

Filter a column depending on value in another column

There is probably a simple solution to this but I can't figure it out. In the simplified view of my data shown below I'd like to filter out all values of 2 and 3 in Column B, but only when the value in Column A is B. This is needed in the query editor.

 

Thank you!

 

Column AColumn B
A1
A2
A3
B1
B2
B3
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @tgjones43 

You can add a custom column using this code for your example then filter out the "remove" and finally delete the custom column.

if [Column A] = "B" and ([Column B] = 2 or [Column B] = 3) then "remove" else "keep"

View solution in original post

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@tgjones43 ,

 

You just need to filter the columns one by one.

 

Firstly filter Column A with value B.

1.PNG 

 

Then filter Column B like below:

Capture.PNG 

 

The result is as below:

3.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

jdbuchanan71
Super User
Super User

Hello @tgjones43 

You can add a custom column using this code for your example then filter out the "remove" and finally delete the custom column.

if [Column A] = "B" and ([Column B] = 2 or [Column B] = 3) then "remove" else "keep"

The solution from @jdbuchanan71 is the simplest, thank you. 

Anonymous
Not applicable

If you need to create in query editor I would create a column that concats col a and b and then add a filter to exclude b2 and b3.

Hope that's enough for you, if you need more detail let me know and i can post more.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.