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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Boingphiwp
Regular Visitor

DAX Date function Direct Query

Issue encountered:

DAX function "Date" I believe has a 16 bit integer limitation on the days compenent.

 

Explanation:

 

I.e. Date(year,month,days)

 

I am inputting 1900,1, [epoch days colum]

 

My data set counts the number of days since 1900/1/1 (ranges from about 38000 - 44000.

 

The maximum Date i have been able to return is: 17 September 1989.

 

This equates to 32,766 days.

 

I find it incredibly likely that since the normal range of a 16 bit integer is −32,768 to 32,767

 

That the maximum Value for the days" component of the "Date" function is a 16 bit value.

 

 

The problem I am engaging with:

I have a list of numbers in an SQL server that correspond to the number of days since 1/1/1.

I have created a new column (by simply minusing 693596) that gives me the number of days since 1/1/1900.

Data typically ranges from 1 - 44,000

 

I am also operating in direct query mode which is limiting my capabilities. 

I am trying to find a solution in either query editor or report editor.

 

 

 

 

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @Boingphiwp

 

The 3rd parameter of the DATE function just represents the calendar day.

 

eg. if today is the 6th of April, 2018.  This would be represented as DATE(2018,4,6) and is not really designed for using the way you are.

 

However why not try this instead.

 

DATE(1900,1,1) + 40000


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @Boingphiwp

 

The 3rd parameter of the DATE function just represents the calendar day.

 

eg. if today is the 6th of April, 2018.  This would be represented as DATE(2018,4,6) and is not really designed for using the way you are.

 

However why not try this instead.

 

DATE(1900,1,1) + 40000


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks for your reply Phil,

 

Your solution worked. It also led me to discover an erroneous peice of data;

 

 

I tried this, and when working with an individual larger number as you've suggested it worked.

 

However, when I try and calculate it based on another column

 

e.g. FmtEntryDate = DATE(1900,1,1)+[1900days]

 

I receive the following error: 

Arithmetric overflow error converting expression to data type datetime.. The exception was raised by the IDataReader interface

 

 

However; I have since discovered 1 erroneous data entry of "-693000", which when excluded using an if statment in the new colum,

 

Allowed my function to work with the direction you provided.

 

Thank you kindly.

 

 

Edit: (the original data is calculating epoch days since 1/1/1)

 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.