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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Helper II
Helper II

Date Function returning error.

Hi, I have a calendar, where the dates are configured by using a function that looks for the earliest date from another table and starts the calendar by the first day of that year.  Then It's invoked.

Table Name is Daily Data)

Function DailyDataRetMaxYear
= let
getDate = (table as table) =>

2) Invoked here
Invoke DailyDataMaxYear = DailyDataRetMaxYear(#"Daily Data")
Result: it correctly returns the latest year from the table it's using

So in power query, I added it it to the first section of creating a calendar. Here's the first few lines of the code, and it works.


// configurations start
Today=Date.From(DateTime.LocalNow()), // today's date
FromYear = DailyDataMinYear, // Use the invoke function here, to get Min Year
ToYear = DailyDataMaxYear, // Use the invoke function here, to get Max Year
StartofFiscalYear=7, // set the month number that is start of the financial year. example; if fiscal year start is July, value is 7
firstDayofWeek=Day.Monday, // set the week's start day, values: Day.Monday, Day, Sunday....
// configuration end

I can clearly see a calendar built based on my specs.
The problem is when I then close and apply this calendar, I get the following message


So if the calendar works find while building it in power query, why does it fail when I load it back?

Help is appreciated!


Community Support
Community Support

Hi , @TheBIGuy_PBI 

According to your description, your error code is "OLE DB or ODBC error: Exception from HRESULT: 0x80040E1D ".

As searched , you can go to Data Model, refresh preview of the query and then apply changes. Make sure no errors in the query, sometime change of datatype in source conflict with query column data type especially date columns.

For more information , you can refer to this i hope it can help you:

Solved: OLE DB or ODBC error: Exception from HRESULT: 0x80... - Microsoft Power BI Community

OLE DB or ODBC error: Exception from HRESULT: 0x80040E1D | Power BI Exchange (

OLE DB or ODBC error: Exception from HRESULT: 0x80040E1D | Power bi Refresh Error دیدئو dideo


Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 


Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.


Power BI Monthly Update - May 2024

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