Forum Discussion

Niraj_vora0106's avatar
Niraj_vora0106
Helper III
3 years ago
Solved

Date master

Hi community,   I've a doubt regarding Date Master,   I tried creating Custom Date table. I've data from 2018 but my Date table is considering weird dates as you can see in the snapshot. ...
  • v-yueyunzh-msft's avatar
    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