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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
lachie-1992
Regular Visitor

Expression:Error: Calculated Column trying to convert to fraction instead of decimal

So i am trying to create a new calculated colum to calculate the true sales price of our products using a calculation, it seems simple enough except i am getting an Expression:Error and i cannot for the life of me work out why? The same calculation is working for half the date and there is no difference other then the numbers being used.

The error im getting is as follows: 

 

Expression:Error: We cannot apply operator / to types Text and Numbers.

Details

 Operator=/

 Left= 27.48

 Right=3

 

In my eyes this should be 9.16? Does anyone have any idea why this would be throwing an error? My calculations for the column are below: We have 4 wholesalers whos true sale price is calculated slightly differently. Wholesaler 4 is where im getting the error, but wholesaler 3 & 4 are excactly the same other then the wholesaler names?

 

net_sales_per_unit = 

if[Wholesaler Name] = "wholesaler1" then ([api_cost_price] -[claim_amount_per_unit])
else if[Wholesaler Name] = "wholesaler2" then ([net_sales_before_claim] / [quantity])
else if[Wholesaler Name] = "wholesaler3" then ([5iproducts.sell_price_1] - ([claim_amount] / [quantity]))
else if[Wholesaler Name] = "wholesaler4" then ([5iproducts.sell_price_1] - ([claim_amount] / [quantity]))
else 0

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @lachie-1992 

 

The error is stating that "We cannot apply operator / to types Text and Numbers" so the first thing you can do is check and apply correct data types on your columns that you use for this calculation.

 

If this does not help, please provide a small data sample + screen prints, including both good records and bad records of base columns and Custom column with the error.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

View solution in original post

4 REPLIES 4
Mariusz
Community Champion
Community Champion

Hi @lachie-1992 

 

The error is stating that "We cannot apply operator / to types Text and Numbers" so the first thing you can do is check and apply correct data types on your columns that you use for this calculation.

 

If this does not help, please provide a small data sample + screen prints, including both good records and bad records of base columns and Custom column with the error.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

Thanks @Mariusz , I have just changed the three columns to Decimal Number and still the same error. Ive added screen grabs of the data below, as you can 

Symbion is Wholesaler3 & Sigma is Wholesaler4 in my code above

 

Screen Shot 2020-04-24 at 4.36.39 pm.pngScreen Shot 2020-04-24 at 4.32.43 pm.png

Hi @lachie-1992 

 

Any chance you can share a sample file?

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Hi @Mariusz  I was being stupid and didnt realise i had changed one of the data types by mistake. Your first answer was correct 🙂

 

Thankyou very much!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors