Forum Discussion
iowakrz
7 years agoFrequent Visitor
Using IF statement to convert a number to negative
The AMOUNT field is a positive number and DOCTYPE determines if the record is a sale or a return. I want to convert the AMOUNT to a negative number in my dataset if it is a return and keep it positive if it is a sale. Doctype=5 for returns and 6 for sales. In Excel I would normally do the following but that doesn’t work. What is the correct syntax? Thanks for any help you can provide.
=IF(SOP30200[DOCTYPE]=5,-SOP30200[AMOUNT] , SOP30200[AMOUNT])
1 Reply
- luisrhResponsive Resident
Suggest you look at at the Switch statement in DAX. Here is a link that gives you details.
https://powerpivotpro.com/2012/06/dax-making-the-case-for-switch/
Good luck!
Luis