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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Copy the value of a column based on condition

i have a following table.

 

column1    Column2

     2                0

     5

     6                0

     12

 

if column2 having null value copy the column1 value. if column2 having 0 value return 0

 

 

expected output

   0

   5

   0

  12

2 ACCEPTED SOLUTIONS
MattAllington
Community Champion
Community Champion

In power query, goto add column, custom column and write a formula (Case sensitive)

 

= if [column2] = null then [column1] else [column2]



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

Anonymous
Not applicable

@Anonymous,

Another method is to create a calcualted column using DAX below.

Column = IF(ISBLANK(YourTable[Column2]),YourTable[column1],YourTable[Column2])

Capture.PNG

Regards,
Lydia

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Anonymous,

Another method is to create a calcualted column using DAX below.

Column = IF(ISBLANK(YourTable[Column2]),YourTable[column1],YourTable[Column2])

Capture.PNG

Regards,
Lydia

MattAllington
Community Champion
Community Champion

In power query, goto add column, custom column and write a formula (Case sensitive)

 

= if [column2] = null then [column1] else [column2]



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.