cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## % difference between 2 negative numbers is a positive when it should be negative

Hi,

I'm hoping someone can help me. I have the below calculated column that compares the current field X to the same field 30 days ago Y to get a % difference

% diff 30 days ago = iferror(table[X]/table[Y],0)

The issue I'm having is if the current field of X is a bigger negative number than Y it gives me a positive value of % change instead of  negative.

e.g X -48613 and Y  -13694 it gives a positive % difference when it should be negative. Is there a way to correct this?

Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

## Re: % difference between 2 negative numbers is a positive when it should be negative

Hi @mloc1990 ,

``% diff 30 days ago =IF(X<0 && Y<0 && X<Y,-1* iferror(table[X]/table[Y],0),iferror(table[X]/table[Y],0))``

I would also use DIVIDE(), but basically wrap in an IF().
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

2 REPLIES 2
Super Contributor

## Re: % difference between 2 negative numbers is a positive when it should be negative

Hi @mloc1990 ,

``% diff 30 days ago =IF(X<0 && Y<0 && X<Y,-1* iferror(table[X]/table[Y],0),iferror(table[X]/table[Y],0))``

I would also use DIVIDE(), but basically wrap in an IF().
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

Frequent Visitor

## Re: % difference between 2 negative numbers is a positive when it should be negative

This works great thanks for your help! I changed my formula a bit to the below and it appears to be doing what I need it too.

% diff 30 days ago = IF(X<0 && Y<0 && X<Y,-1* iferror(X/Y,0)+1,iferror(X/Y,0)-1)

Thanks!

Announcements

Kudos to you if you earned one of these! Check your inbox for a notification.

#### Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

#### Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (3,723)