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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
gparrin71
New Member

Update column with PQuery

Hi,

How can I update,with powerquery, the first column of the attached photo with the data of the second if the value is different?

 

gparrin71_0-1640873814528.png

Tnks a lot

Gianni

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

Are the columns already in one table?

 

If not merge the two tables in power query on a common set of columns.

 

You can then create custom columns with if statements that take the 2nd value unless it's null in which case use the 1st.

 

Finally remove the old columns and renames the new ones correctly.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

6 REPLIES 6
gparrin71
New Member

Hi,

The function you suggested gives me the same problem I had with a function I had already tried. The status "ORDERED" does not change to "DELIVERED"

 

gparrin71_0-1640883184038.png

Tanks

Gianni

Can you send a demo pbix file? Think i'm

missing something about your specification.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
gparrin71
New Member

Thanks to the immediate response.
Yes, they are already in a table.
I'm just starting out with custom columns. Can you tell me how to do it?

No problem.

 

I started with a demo table like this:

bcdobbs_0-1640878820165.png

Then clicked Add Column >> Custom Column

bcdobbs_1-1640878873379.png

 

Syntax I used was:

if [New Column A] = "" 
then [Original Column A]
else [New Column A]

(Note that if, then and else have to be lower case in Power Query M )

 

Results in:

bcdobbs_2-1640879008059.png

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
bcdobbs
Community Champion
Community Champion

Depending on your source you might have nulls instead of empty text so the following is more hardened:

if [New Column A] = "" or [New Column A] = null
then [Original Column A]
else [New Column A]

bcdobbs_3-1640879215680.png

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
bcdobbs
Community Champion
Community Champion

Are the columns already in one table?

 

If not merge the two tables in power query on a common set of columns.

 

You can then create custom columns with if statements that take the 2nd value unless it's null in which case use the 1st.

 

Finally remove the old columns and renames the new ones correctly.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors