Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Dynamic Date table ending at current year

Hello All,

 

I am using CalendarAuto function for creating dynamic date table. Since my data model has 2021 data, this calendar table is getting extended to 2021 (Screenshot #1). I want to change it to calendar function which should only go upto end of the the current year (e.g. 2020 till Dec 31, 2020 and 2021 from Jan 1, 2021).

This is becasue , this calendar is getting used in another 'next month ' query (screenshot#2) . So if its dec 2020, the next month it is considering is Jan -2022.

 

 

#1

Screenshot#1

 

#2Screenshot#2

 

  • You could change your Calendar table or that measure.  For the Calendar you could use 

    CALENDAR(DATE(YEAR(TODAY())),1,1), DATE(YEAR(TODAY()),12,31))

     

    or in the measure, you could just use DATE(YEAR(TODAY()),12,31) in place of your EDATE

     

    Regards,

    Pat

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    You could change your Calendar table or that measure.  For the Calendar you could use 

    CALENDAR(DATE(YEAR(TODAY())),1,1), DATE(YEAR(TODAY()),12,31))

     

    or in the measure, you could just use DATE(YEAR(TODAY()),12,31) in place of your EDATE

     

    Regards,

    Pat

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the response . This worked.