Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Solved! Go to Solution.
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.
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.
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
Hi @lachie-1992
Any chance you can share a sample file?
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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.