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

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.

Reply
rbowen
Helper I
Helper I

Flip Number To Negative Based On A Different Column

Howdy All - 

 

I'd like to create a calculated column that flips a number to it's negative value based on a second column's designation of debit or credit.  The table below is the one I'm trying to do this in - it's being pulled in from one of our DB's so can't flip the sign in the DB unfortunately. I'd like the DAX to first look at the debcred column, if the value is 'D', then take the value in the amount column and put it into the calculated column but with a negative sign. If the value is a 'C', just copy the value into the calculated column without changing its sign. There's a way to do this in Excel with a -ABS function but, from what I can tell, the DAX version of that function doesn't support that (or does it??).  Is there a DAX statement that will accomplish what I'm after?

 

Thank you

 

rbowen_0-1692051902639.png

 

 

 

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

There is the ABS function in dax: https://learn.microsoft.com/en-us/dax/abs-function-dax

but, you can always just use -1 * [amount], or even -[amount]

vicky__0-1692052855115.png

 

View solution in original post

2 REPLIES 2
vicky_
Super User
Super User

There is the ABS function in dax: https://learn.microsoft.com/en-us/dax/abs-function-dax

but, you can always just use -1 * [amount], or even -[amount]

vicky__0-1692052855115.png

 

Thank you Vicky, that worked. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.