Skip to main content
cancel
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.

Reply
Rsing
Frequent Visitor

DAX function

What is the difference between calendar and calendar Auto. Please explain with example.

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Rsing 

The CALENDAR and CALENDARAUTO functions in DAX are both used to generate date tables. However, there are some key differences between the two functions.

CALENDAR

The CALENDAR function takes two arguments: a start date and an end date. It returns a table with a single column named Date that contains all of the dates between the start date and the end date, inclusive.

CALENDAR(StartDate, EndDate)
For example, the following code will create a date table that contains all of the dates between January 1, 2020 and December 31, 2020:

Calendar(Date(2020,1,1), Date(2020,12,31))
CALENDARAUTO

The CALENDARAUTO function does not take any arguments. It returns a table with a single column named Date that contains all of the dates in the current model. The date range is calculated automatically based on the data in the model.

CALENDARAUTO()
For example, if the current model contains a table of sales with a Date column, the CALENDARAUTO function will return a table that contains all of the dates in the Date column.

Key Differences

The main difference between the CALENDAR and CALENDARAUTO functions is that the CALENDAR function allows you to specify a custom date range, while the CALENDARAUTO function automatically calculates the date range based on the data in the model.

Here is a table that summarizes the key differences between the two functions:

Ritaf1983_0-1715223632703.png

Also, take a look at the linked video :

https://www.youtube.com/watch?v=b23bk6TcXak

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

 

View solution in original post

5 REPLIES 5
Uzi2019
Super User
Super User

Hi @Rsing 

 

Refer below video for better undertanding with proper example
https://www.youtube.com/watch?v=pIIk42R4ex4

https://www.youtube.com/watch?v=wyl7Lvj2EJ8

 

I hope I answered your questioned!

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Ritaf1983
Super User
Super User

Hi @Rsing 

The CALENDAR and CALENDARAUTO functions in DAX are both used to generate date tables. However, there are some key differences between the two functions.

CALENDAR

The CALENDAR function takes two arguments: a start date and an end date. It returns a table with a single column named Date that contains all of the dates between the start date and the end date, inclusive.

CALENDAR(StartDate, EndDate)
For example, the following code will create a date table that contains all of the dates between January 1, 2020 and December 31, 2020:

Calendar(Date(2020,1,1), Date(2020,12,31))
CALENDARAUTO

The CALENDARAUTO function does not take any arguments. It returns a table with a single column named Date that contains all of the dates in the current model. The date range is calculated automatically based on the data in the model.

CALENDARAUTO()
For example, if the current model contains a table of sales with a Date column, the CALENDARAUTO function will return a table that contains all of the dates in the Date column.

Key Differences

The main difference between the CALENDAR and CALENDARAUTO functions is that the CALENDAR function allows you to specify a custom date range, while the CALENDARAUTO function automatically calculates the date range based on the data in the model.

Here is a table that summarizes the key differences between the two functions:

Ritaf1983_0-1715223632703.png

Also, take a look at the linked video :

https://www.youtube.com/watch?v=b23bk6TcXak

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

 

Thanks for your quick and clear response. Now my confusion is clear.

Happy to help 🙂

Wilson_
Memorable Member
Memorable Member

Rsing,

 

Check this link out: https://www.sqlbi.com/tv/calendar-calendarauto-dax-guide/


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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