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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ajinkyacgaikwad
Advocate I
Advocate I

Power query division while adding column

I am dividing two columns named Value (USD) and Weight 

 

= Table.AddColumn(#"Replaced Value", "unit price", each if [Value (USD)] = 0 or [quantity]=0 then null
else try [Value (USD)]/[quantity] otherwise null)

 

It seems to me some format issue.

ajinkyacgaikwad_0-1670354563011.png

Please help me 

 

1 ACCEPTED SOLUTION
AntrikshSharma
Super User
Super User

@ajinkyacgaikwad Since your column name has a space and an unsported character for names "(" you need to use #""

 

Table.AddColumn(
    #"Replaced Value", 
    "unit price", 
    each 
        if [#"Value (USD)"] = 0 
            or [quantity] = 0 
        then null
        else 
            try [#"Value (USD)"] / [quantity] 
            otherwise null
)

 

View solution in original post

1 REPLY 1
AntrikshSharma
Super User
Super User

@ajinkyacgaikwad Since your column name has a space and an unsported character for names "(" you need to use #""

 

Table.AddColumn(
    #"Replaced Value", 
    "unit price", 
    each 
        if [#"Value (USD)"] = 0 
            or [quantity] = 0 
        then null
        else 
            try [#"Value (USD)"] / [quantity] 
            otherwise null
)

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors