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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
JimB-GA
Helper III
Helper III

adding duration to date

 Hello community.

 

I have a table with one field that is number of days  in it (decimal). I want to add this to a calendar date (01/01/1970).  I have researched all options and am doing something wrong as each effort results in an error.

 

As close as I have been able to get is

[T1] = 17905.72715   This is the number of days since 01/01/1970

 

Date.AddDays(DateTime.FromText("1970-01-01"),[T1])

 

The error returned is "Expression Error: The number is out of range of a 32 bit integer value.  Details: 17905.72715

 

Thanks for advice.

 

Regards

 

Jim B

 

1 ACCEPTED SOLUTION

Try changing [T1] to Duration and then simply use + to add DateTime.FromText("1970-01-01") and [T1].Untitled.png

View solution in original post

4 REPLIES 4
tarunsingla
Solution Sage
Solution Sage

Try changing [T1] to a Whole Number. DateAdd expects a whole number, and not a decimal.

Is there another function that will accept decimal values?  The resulting value would represent intraday prices and eliminating the decimal portion would result in an inaccurate value.

Try changing [T1] to Duration and then simply use + to add DateTime.FromText("1970-01-01") and [T1].Untitled.png

Thanks very much.  It works.

 

I just have to adjust for time zone and I have the total solution.

 

Jim B

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.