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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
beanandrew18
Frequent Visitor

Exclude values from an IF Statement if that value is found anywhere in another column

I have a table that has two different columns generating values based off of IF Statements. However, there is some overlap in the logic that causes values to populate in both columns. What I need is a DAX function that does not populate a value in column 2, if that same value is found in any row in column 1. If the value is not already somewhere in column 1, it can populate the value in column 2 See below. 

 

The logic for column 1&2 is essentially:

IF(AND(Test 1 = x, Test 2 = y), Table['Part Number'], "")

 

Current Data:

Part NumberColumn 1Column 2
151015101510
151015101510
151015101510
1510 1510
1510 1510
1510  
1700 1700
1700 1700

 

Needed Data:

Part NumberColumn 1Column 2
15101510 
15101510 
15101510 
1510  
1510  
1510  
1700 1700
1700 1700
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your logic correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

It is for creating a new table.

 

Jihwan_Kim_0-1716213923890.png

 

 

expected result table = 
	VAR _list = VALUES(Data[Column 1])
	VAR _t = SELECTCOLUMNS(
		Data,
		"@part_number", Data[Part Number],
		"@column01", Data[Column 1],
		"@column02", IF(
			NOT (Data[Column 2] IN _list),
			Data[Column 2]
		)
	)

	RETURN
		_t

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your logic correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

It is for creating a new table.

 

Jihwan_Kim_0-1716213923890.png

 

 

expected result table = 
	VAR _list = VALUES(Data[Column 1])
	VAR _t = SELECTCOLUMNS(
		Data,
		"@part_number", Data[Part Number],
		"@column01", Data[Column 1],
		"@column02", IF(
			NOT (Data[Column 2] IN _list),
			Data[Column 2]
		)
	)

	RETURN
		_t

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

非常棒,你帮助了我。
并为我提供了新思路!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.