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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
rashid0146
Regular Visitor

creating a new column using values from 2 columns of the same table

Hi All

 

I have two columns, one is customer ID and 2nd is Customer Parent. I need a 3rd column containg values from first and 2nd as shown below.

 

Customer ID        Customer Parent ID        3rd Column (I Want to Create in Power BI)

0001                     0010                                  0010

0002                                                               0002

0003                     0010                                  0010

0004                                                               0004

0005                     0011                                  0011

0006                                                               0006

0007                                                               0007

 

Regards

Rashid Anwar

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Column3 = IF(ISBLANK([Customer Parent ID]),[Customer ID],[Customer Parent ID])


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-sihou-msft
Microsoft Employee
Microsoft Employee

@rashid0146

 

You can use DAX to create a calculated column as @Greg_Deckler suggested.

 

This can also be achieved via Power Query:

 

= if [Column2] is null then [Column1] else [Column2]

23.PNG

 

Regards,

View solution in original post

5 REPLIES 5
v-sihou-msft
Microsoft Employee
Microsoft Employee

@rashid0146

 

You can use DAX to create a calculated column as @Greg_Deckler suggested.

 

This can also be achieved via Power Query:

 

= if [Column2] is null then [Column1] else [Column2]

23.PNG

 

Regards,

Greg_Deckler
Super User
Super User

Column3 = IF(ISBLANK([Customer Parent ID]),[Customer ID],[Customer Parent ID])


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi Smoupre

 

I applied your formula Column3 = IF(ISBLANK([Customer Parent ID]),[Customer ID],[Customer Parent ID]) but it is not picking the value for blak field. I mean it is giving the following results shown in 3rd column. One thing to note that source of data is SQL server. I guess ISBLANK function si not recognizing the Blank fields in Customer Parent ID table as blank that is why returning the results.

 

Customer ID        Customer Parent ID        3rd Column (I Want to Create in Power BI)
0001                     0010                                  0010
0002                                                              
0003                     0010                                  0010
0004                                                              
0005                     0011                                  0011
0006                                                              
0007                                                              

Thank you very much. It works Smiley Happy

 

Rashid Anwar

tnoflahc
Frequent Visitor

Greetings rashid0146,

 

This may be of some help to you:

 

http://community.powerbi.com/t5/Desktop/help-how-to-merge-2-columns/td-p/53920

 

This link is a blog post that has a little more background than just the process identified in the above link: 

https://businessintelligist.com/2015/09/15/power-bi-desktop-merge-query-options/

 

I hope this leads you to your solution.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.