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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
peegee68
Frequent Visitor

Inversing numeric columns +/-

Hi,

 

I'm a rookie stuck on this one, and after searching around for a little while thought I'd ask the community for help.

 

I have created a custom column to work out the difference in days between a Due Date and Today's date.  The calc I've used is:

 

"Due Date Difference", each Duration.Days(DateTime.Date(DateTimeZone.UtcNow()) - [Due Date]

 

The results are good, but I want to inverse their +/- so that any due date before the current date is a negative number (overdue) and a future due date is a positive number (coming up due).  Current results show anything due after today's date as negative number, with anything before today's date is positive.

 

Tried playing around with a few things that resulted in errors.  Saw that multiplying the column by -1 would inverse the numbers but having a problem figuring out whether I can do this in the calc above or do I need another column/formula to do this?

 

Any assistance appreciated.

Paul

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @peegee68,

 

this formula

Duration.Days(DateTime.Date(DateTimeZone.UtcNow()) - [Due Date]) * -1

is inversing the values:
image.png

As you can see the future due date is positive, future, from today's perspective:
image.png

From a performance point of view, I recommend calculating the difference and inversing the result in a single formula.

 

Hopefully, this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
peegee68
Frequent Visitor

Thanks very much for the simple solution.  I did play around with this but must have had the syntax incorrect or something otherwise in the wrong place???

 

TomMartens
Super User
Super User

Hey @peegee68,

 

this formula

Duration.Days(DateTime.Date(DateTimeZone.UtcNow()) - [Due Date]) * -1

is inversing the values:
image.png

As you can see the future due date is positive, future, from today's perspective:
image.png

From a performance point of view, I recommend calculating the difference and inversing the result in a single formula.

 

Hopefully, this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors