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
Andmi
Frequent Visitor

IF a value of a cell is empty return the value of another one

Hi All,

 

I have a column A with some values and some blank ones.

Is it possible to create a new column B where the value is equal of the column A value except when it is empty where it should return the value of column C?

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

In DAX that would be:

 

[B] = IF(ISBLANK([A]),[C],[A])

In Power Query (M) it would be:

 

= Table.AddColumn(#"Changed Type", "Custom", each if [A] = null then [C] else [A])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

heryox
New Member

You can use this after add column in power query editor:

if ColumnA = 'yourvalue'  then ColumnA

         Else ColumnC

 

This save your column before do all on data 🙂

 

if this help you mark this as a solution!

Thank you 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

I have used the formula 

= Table.AddColumn(#"Changed Type", "Custom", each if [A] = null then [C] else [A])

But power query Excel doesn't recognise "null" as "null" and for some reason new column value is looks empty although column C has value and A doesn't have, power query show A.

Hi,

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Greg_Deckler 

Perhaps you can help me out:

 

= Table.AddColumn(#"Changed Type", "Custom", each if [A]= null then [B] else [C])

 

Does this fill Custom with B if A is null and with C if A and B are empty? I am still getting null back as a result hile one of the 3 cells are filled for sure.

Thanks!

heryox
New Member

You can use this after add column in power query editor:

if ColumnA = 'yourvalue'  then ColumnA

         Else ColumnC

 

This save your column before do all on data 🙂

 

if this help you mark this as a solution!

Thank you 

Greg_Deckler
Super User
Super User

In DAX that would be:

 

[B] = IF(ISBLANK([A]),[C],[A])

In Power Query (M) it would be:

 

= Table.AddColumn(#"Changed Type", "Custom", each if [A] = null then [C] else [A])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.