Subtraction between 2 columns issue

I need to find the difference between 2 columns (AV and BV) and show on a column of the table and on the next column to show the same difference as a percentage.
Now for the percentage it works perfectly fine when I do this:
(sum({AV}) - sum({BV})) / sum({AV})

But for the simple subtraction to show the difference is throwing an error on the visual called Your calculated field expression contains invalid syntax when I do this:
sum({AV})-sum({BV})
but if I do the same without sum like : {AV}-{BV} no error it works but the subtraction result is wrong

What am I doing wrong here to get the percentage difference correct but not the subtraction ?

  1. Check the underlying dataset to see if there are any errors or inconsistencies in the data source.
  2. Check if the data type and formatting of the columns - {AV}, {BV} and {Diff} are the same. Data type mismatch and inconsistent formatting could lead to incorrect results.
  3. Ensure data is not aggregated for any column i.e., sum({AV}) or sum({BV}).
  4. Make sure both columns are dimensions or measures. Try the Difference(AV,BV) function if both are measures.
    Let us know if any of this helps?
    Thanks!
1 Like

Hi @rumesh,
It’s been awhile since we last heard from you, did you have any additional questions regarding your initial topic?

If we do not hear back within the next 3 business days, I’ll go ahead and close out this case.

Thank you!

Hi @rumesh,
Since we haven’t heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new topic in the community and link this discussion for any relevant information that may be needed.

Thank you!