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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Justair07
Resolver I
Resolver I

Trying to Create a Dynamic Calendar

Hi,

 

I'm trying to use the CALENDAR function to create a dynamic calendar table. Here is my DAX:

TimelineDates = CALENDAR(DATE([SelectedYear],01,01),DATE([SelectedYear],12,31))

[SelectedYear] is a measure I created

SelectedYear = SELECTEDVALUE(TimelineYear[Year])

I have a slicer where I select the year, the slicer field is Timeline[Year]

I know the measure is working because I added the results to a Card and it returns the selected year from the slicer perfectly.

 

However, when I add the measure to the CALENDAR function it isn't working. The Calendar creates a date range with the year being 1900, this leads me to belive that the measure is being seen as a 0 in the CALENDAR function.

 

I also thought maybe I needed to convert the mesaure result to a VALUE so I tried this:

TimelineDates = CALENDAR(DATE(VALUE([SelectedYear]),01,01),DATE(VALUE([SelectedYear]),12,31))

The results are still the same as before, see picture below.Capture.JPG

Is what I'm trying to do possible? If not is there another way?

 

Thank you,

 

-Justair07

6 REPLIES 6
rajulshah
Super User
Super User

Hello @Justair07,

Please note that SELECTEDVALUE doesn't work for calculated columns and tables.

Hi @rajulshah ,

 

I was afraid of that. Do you know of another way I can achive my overall goal? Another method to create a dynamic calender based on a slicer selection?

 

Thank you

 

-Justair07

@Justair07,

 

Do you want a physical table or table that is to be used in a measure?

Hi @rajulshah,

 

I might not understand the difference between a physical table and a table so forgive me but my initial thought is either should work. I have a calander already created entirley from M in the Power Query Editor. My goal was to have the dynamic calender only show a date range for a single year based on the slicer selection. Hope this answers your question.

 

Thank you,

-Justair07

@Justair07,

 

Yes, I got you. But I don't think so there is any other way for that. 

@rajulshah ,

 

Darn. Well thank you. I'll leave this posted for another day or so as unsolved to see if someone has an idea of how to do this.

 

Thank you for all of your help!

 

-Justair07

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.