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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

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
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.