Forum Discussion
Date master
- 3 years ago
Hi , Niraj_vora0106
According to your description, you want to create a date table. And now you use the calendarauto() function.
For this , i do not recommend you to use the calendarauto() function. Because it auto-create a date table from all the date type column from your date source, it will affect performance.
I recommand you to use calendar() function to create a date table , like this:
Calendar = ADDCOLUMNS( CALENDAR(FIRSTDATE('Table'[Date]),LASTDATE('Table'[Date])), "Year", YEAR ( [Date] ), "Quarter", ROUNDUP(MONTH([Date])/3,0), "Month", MONTH([Date]), "Week", weeknum([Date]), "Year_Quarter", year([date]) & "Q" & ROUNDUP(MONTH([Date])/3,0), "Year_Month", year([Date]) * 100 + MONTH([Date]), "Yeer_WeekNum", year([Date]) * 100 + weeknum([Date]), "Weekday", WEEKDAY([Date],2) )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
Hi , Niraj_vora0106
According to your description, you want to create a date table. And now you use the calendarauto() function.
For this , i do not recommend you to use the calendarauto() function. Because it auto-create a date table from all the date type column from your date source, it will affect performance.
I recommand you to use calendar() function to create a date table , like this:
Calendar = ADDCOLUMNS(
CALENDAR(FIRSTDATE('Table'[Date]),LASTDATE('Table'[Date])),
"Year", YEAR ( [Date] ),
"Quarter", ROUNDUP(MONTH([Date])/3,0),
"Month", MONTH([Date]),
"Week", weeknum([Date]),
"Year_Quarter", year([date]) & "Q" & ROUNDUP(MONTH([Date])/3,0),
"Year_Month", year([Date]) * 100 + MONTH([Date]),
"Yeer_WeekNum", year([Date]) * 100 + weeknum([Date]),
"Weekday", WEEKDAY([Date],2)
)
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
- Niraj_vora01063 years agoHelper III
This works.
Thank you!