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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
igonzalez_ep
New Member

Getting value from 2 columns to create one column

I want to create a new column that will give me the value of columnA if theres a value but if there isnt get the value from columnB otherwise jut give me a null.

 

I already tried the following formula but i only get values from columnA:

 

= IF(ISBLANK([ColumnA]), [ColumnB], "null")

and = IF(ISBLANK(ColumnA), IF(ISBLANK(Column),"null",Column),ColumnA)

 

I also cleaned up the columns for any hidden characters. 

Let me know if you have any thoughts to get this to work.

Thank you

IG

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @igonzalez_ep 

First, I would confirm that the columns contain true blank values.

One method: in Table view, click the filter dropdown:

Empty string (not blank)

OwenAuger_2-1743291454449.png

 

Actual Blank:

OwenAuger_1-1743291429206.png

You may need to replace empty string values with nulls in Power Query:

OwenAuger_3-1743291618595.png

Null values in Power Query will appear as italicised null in the Power Query Editor.

 

Once you are sure you have blank values in the relevant columns, you could create this DAX calculated column:

= COALESCE ( YourTable[ColumnA], YourTable[ColumnB], "null" )

 You could also add a custom column in Power Query with this expression (using the null-coalescing operator ?? )

= [ColumnA] ?? [ColumnB] ?? "null"

 Does any of the above help?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

5 REPLIES 5
v-menakakota
Community Support
Community Support

Hi @igonzalez_ep ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi @igonzalez_ep ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

 

Hi @igonzalez_ep ,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

ZhangKun
Super User
Super User

Hi @igonzalez_ep 

You should use the LEN function to check if the "blank cell" is really blank.

ZhangKun_0-1743346105218.png

 

OwenAuger
Super User
Super User

Hi @igonzalez_ep 

First, I would confirm that the columns contain true blank values.

One method: in Table view, click the filter dropdown:

Empty string (not blank)

OwenAuger_2-1743291454449.png

 

Actual Blank:

OwenAuger_1-1743291429206.png

You may need to replace empty string values with nulls in Power Query:

OwenAuger_3-1743291618595.png

Null values in Power Query will appear as italicised null in the Power Query Editor.

 

Once you are sure you have blank values in the relevant columns, you could create this DAX calculated column:

= COALESCE ( YourTable[ColumnA], YourTable[ColumnB], "null" )

 You could also add a custom column in Power Query with this expression (using the null-coalescing operator ?? )

= [ColumnA] ?? [ColumnB] ?? "null"

 Does any of the above help?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.