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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Dynamic use of MAX date of a fact tabe

In my PBI report I created a Date_Calendar table using DAX:

 

                  Date_Calendar =

                                    GENERATE (      

                                     CALENDAR(Date(2019,1,1),Date(2021,12,31)),

                                    Etc…

 

Then I mapped Date_Calendar[Date] to the Date fields in 2 fact tables. However, currently, data from the 2 fact tables do not go beyond July 2020, whereas the end date for the Date_Calendar table is set to Dec 2021.

 

How can I create a column or measure such that it will always be the latest available date in the PTO fact table, and such that I can use that new field/column to filter on the Date_Calendar[Date] slicer so that no one can choose a date/month that has no data, since the latest date they can choose is the date which has the latest available date.

 

Hope my question makes sense. Thanks!

1 ACCEPTED SOLUTION

That expression is to create a new DAX table, not a measure.  Replace your hard-coded Date values in your current Date table with the dynamic ones.

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

5 REPLIES 5
mahoneypat
Microsoft Employee
Microsoft Employee

You can use dynamic expression inside Calendar( ).  Like this - Calendar(Min(PTO[Date]), Max(PTO[Date]))

You can also do start and end of month calculations if you prefer.

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

It's not letting me. See screenshot. 

PTO is a table of start and end dates of PTO that employees requested.

So, I actually want the min date of Start Date and max date of End Date, to make sure that I capture the widest range of dates available. The dax measure below I tried to put in my Date_Calendar table, but I've never referenced the Date field of other tables.

 

Capture3.JPG

That expression is to create a new DAX table, not a measure.  Replace your hard-coded Date values in your current Date table with the dynamic ones.

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

I am missing one field from the old Calendar_Date table that I need. And that is the 'day' field.

i.e. Monday, Tuesday, etc.
Can you tell me how to create 'day' in this new Date table? Thanks.
Anonymous
Not applicable

That worked. Thanks!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors