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
Centaur
Helper IV
Helper IV

If field is NULL then use other field

 

Hello, 

 

I need to combine 2 columns based on if one of them is NULL. 

I will say it in English:

if [Name_FBL1N_Stampli] is Null then use [VendorList2.Name]

If [VendorList2.Name] is Null then use [Name_FBL1N_Stampli] 

Combine into 1 column.   

I have been fiddling around with it but its not giving me what I want.

 

thank you.

 

Centaur_0-1649528026625.png

 

here is the advanced editor: 

let
Source = Table.FuzzyNestedJoin(VendorList_2, {"Name_FBL1N_Stampli"}, VendorList, {"COMPANY_NAME"}, "VendorList", JoinKind.LeftOuter, [IgnoreCase=true, IgnoreSpace=true, Threshold=.5]),
#"Reordered Columns" = Table.ReorderColumns(Source,{"Name_FBL1N_Stampli", "VendorList2.Vendor", "Vendor Code", "ConsolidateSTAMPLI.DrawNo", "ConsolidateSTAMPLI.Category", "VendorList"}),
#"Added Conditional Column" = Table.AddColumn(#"Reordered Columns", "Custom", each if [VendorList2.Vendor] = "" then [Name_FBL1N_Stampli] else null),
#"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"Custom"})
in
#"Removed Columns"

1 ACCEPTED SOLUTION
watkinnc
Super User
Super User

How about a bit of Power Query technical talk that will help you figure it out? "" and null are not equal or interchangeable. I'm not sure if you have actual "" or nulls in your dataset.

Another very important thing to remember is that when combining text columns, any null value makes the whole combined text null. So Text.Combine("SomeText", null)//equals null

 

Yiu can replace the nulls first with some text value that you are sure will never be used to delimiter your text, like "ZZZZ".  Then combine your text, and then split off the "ZZZZ".

 

But I suspect that it's the tact combined with null that is the issue.

 

--Nate

 


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

4 REPLIES 4
Vijay_A_Verma
Super User
Super User

Use this in a custom column

= if [Name_FBL1N_Stampli] is null then [VendorList2.Name] else [Name_FBL1N_Stampli]

My solution was 2 custom columns, one checking for null and one checking for not null.

watkinnc
Super User
Super User

How about a bit of Power Query technical talk that will help you figure it out? "" and null are not equal or interchangeable. I'm not sure if you have actual "" or nulls in your dataset.

Another very important thing to remember is that when combining text columns, any null value makes the whole combined text null. So Text.Combine("SomeText", null)//equals null

 

Yiu can replace the nulls first with some text value that you are sure will never be used to delimiter your text, like "ZZZZ".  Then combine your text, and then split off the "ZZZZ".

 

But I suspect that it's the tact combined with null that is the issue.

 

--Nate

 


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Hi, thank you.  I think the value is not NULL as you stated even though it says its NULL.  That formula provided by was the same formula I tried but it doesnt change the NULL value.  I have reverted to another strategy.   thank you. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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