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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Problem with CalendarAuto()

I am following advice on how to look at changes in invoices in this thread and the solutions requires the use of the CalendarAuto() function. More specifically, it requires the use of a DateTable (that I am trying to figure out) but I'm getting an error (when trying to use the following code, stating "CALENDARAUTO function can not find a base column of DateTime type in the model". (First Screen shot)

 

As to the table with date-related info, I am getting "Month_Nbr" and "Year_Nbr" from the SQL database (there is no "date" field ironically) and then I concantenate that and convert that to a "Data Type = Date", the "Combined_Date" field (Second Screen shot).

 

I then also create a "New Date" field which is just a dupliate of the "Combined_Date" field, but made into a "Date/Time" type (third screen shot).

 

I'm not sure why I'm getting the error with CalendarAuto(). Any help would be appreciated!

 

 

rsearing_0-1652726201316.png

 

 

rsearing_1-1652726481752.png

 

 

rsearing_2-1652726694501.png

 

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Instead of constructing the date column in InvoiceData table via DAX, you would do it in Power Query.

Add a custom column similar to this :

#date(year, month, day)  - all numbers.

Make sure it has date type.

Calendar auto should be able to find and use this.

-----

If you want to go the DAX route, using CALENDAR function, an example is:

CALENDAR (
    DATE ( 2010, 1, 1 ),
    DATE ( 2017, 12, 31 )
)

you could hardcode the month and day and use MinYear and MaxYear variables which you already have.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@HotChilli , that was it. Apparently it didn't like the DAX and I was able to use the #date(year, month, day) in PQ. Thank you SO much for your help!

HotChilli
Super User
Super User

Instead of constructing the date column in InvoiceData table via DAX, you would do it in Power Query.

Add a custom column similar to this :

#date(year, month, day)  - all numbers.

Make sure it has date type.

Calendar auto should be able to find and use this.

-----

If you want to go the DAX route, using CALENDAR function, an example is:

CALENDAR (
    DATE ( 2010, 1, 1 ),
    DATE ( 2017, 12, 31 )
)

you could hardcode the month and day and use MinYear and MaxYear variables which you already have.

speedramps
Super User
Super User

Dont use CALEANDERAUTO.

Click here to watch free videos instead. Including a free calendar download. 

It is a really good video course

Please click thumbs up and accept as solution button.  Thanks ! 😀

HotChilli
Super User
Super User

CalendarAuto can't find any relevant dates. I think you are expecting the calculated column to be the date but calendarauto doesn't like dax calculated columns.

You should probably create the datecolumn in power query (or use the CALENDAR dax function and create the dates to use as parameters)

Anonymous
Not applicable

@HotChilli that would make sense (not liking the created date column).

I'm rather new and was hoping you might give an example of what you mean by creating the date column in PQ please. (Thank you for your feedback).

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors