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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
iowakrz
Frequent 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 1
luisrh
Responsive Resident
Responsive 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

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.