Home > Back-end >  Convert value to negative [closed]
Convert value to negative [closed]

Time:10-05

I have a table of sales data that includes returns that the system is returning as a normal number instead of a negative.

CASE 
    WHEN OXSALE.XRCD = 2000 
        THEN (OXSALE.SAPR * OXSALE.IVQT) * (-1)
        ELSE OXSALE.SAPR * OXSALE.IVQT 
END AS CURRENT_SELLING_PRICE

When the column OXSALED.XRCD is equal to 2000, then the calculated sales value need to be returned.

I know the above should work but when I run my query the value is not changing to a negative.

What have I missed?

Appreciate any help on this.

Thanks

CodePudding user response:

Found the error when pulled all the field as individual columns in the output. Thanks @DStanley. Formatting error.

CodePudding user response:

I think we need to know what values you are getting as this your example works in my local machine.

refer to this post for other methods.

how to change positive value to negative

  • Related