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
yc-bsa
Regular Visitor

Help please - if null replace with data from another column

Hi All, 

I am trying to adding a new column basically combining the data from the first two columns (marked A & B in the image). 

If column A has a A, new column = A. 

Or if column A is null, new column = B. 

I tried to use 'add column' and 'add conditioned column' and both came back with the same result - new column is only picking up value from column A but not column B. 

Can someone please help and tell me what I have done wrong?? 

I changed the data type after adding the new column but doesn't solve the problem. 

Thank you. 

ycbsa_0-1637299633235.png

ycbsa_1-1637299729864.png

 

 

6 REPLIES 6
V-lianl-msft
Community Support
Community Support

Hi @yc-bsa ,

 

After trying what @Gabriel_Walkman said, does the problem still exist?

If the problem persists, could you share a sample pbix after deleting sensitive data?

 

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

 

Hi @V-lianl-msft ,

No, that doesn't solve the problem. 

I am unable to attach the file so I did another screenshot to show what the problem is if that helps to clarify my question. 

Gabriel_Walkman
Continued Contributor
Continued Contributor

I'd guess empty is not the same as N/A. Try N/A or null instead of that empty field in your conditional column.

Hi Gabriel, 

Thanks for your reply. I did try using null.type but same result (only pick up from column A)

ycbsa_0-1637307214041.png

ycbsa_1-1637307235263.png

 

 

Try "N/A" instead of Null.Type. Or replace the N/A values to null and then check for null (not Null.Type).

Hi Gabirl, 

Thanks for your help, but both null and 'N/A' are part of the data so I cannot replace them. 

Somehow I cannot attach the file so I have attached a photo of the sample data, hopefully that helps to explain better what I am trying to ask: 

- if column 'ID category' has a value, column 'Category' should equal to this value no matter what (even if it's 'N/A');

-only if column 'ID category' is null, column 'Category' should equal to 'Type Category'

 

ycbsa_0-1637814477419.png

but as you can, my formula is only picking up value from 'ID category', even if it is null, it won't picking up fom 'type category'

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.