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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Caldowd98
Helper I
Helper I

Date Table

Hi community

 

I have a dataset where the last entry against a date is 01.09.2022. My current date table (below) returns a date table with the last date 31.12.2022.

How would i change this so it returns the maximum date in the dataset and not the final day of the year of this date ?

 

Date Table =
ADDCOLUMNS(
CALENDARAUTO(),
"YEAR", YEAR([Date]),
"Month", FORMAT([Date], "mmmm"),
"MONTH NUMBER", MONTH([Date]))
 
Thanks!! 🙂
1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Let's say the date field in your fact table is called 'FactTable'[Date]

You can limit the start and end date in the calendar table by using:

Date Table =
VAR _MinDate =
    MIN ( FactTable[Date] )
VAR _MaxDate =
    MAX ( FactTable[Date] )
RETURN
    ADDCOLUMNS (
        CALENDAR ( _MinDate, _MaxDate ),
        "YEAR", YEAR ( [Date] ),
        "Month", FORMAT ( [Date], "mmmm" ),
        "MONTH NUMBER", MONTH ( [Date] )
    )

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
PaulDBrown
Community Champion
Community Champion

Let's say the date field in your fact table is called 'FactTable'[Date]

You can limit the start and end date in the calendar table by using:

Date Table =
VAR _MinDate =
    MIN ( FactTable[Date] )
VAR _MaxDate =
    MAX ( FactTable[Date] )
RETURN
    ADDCOLUMNS (
        CALENDAR ( _MinDate, _MaxDate ),
        "YEAR", YEAR ( [Date] ),
        "Month", FORMAT ( [Date], "mmmm" ),
        "MONTH NUMBER", MONTH ( [Date] )
    )

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thanks Paul - perfect 🙂

mangaus1111
Solution Sage
Solution Sage

Hi @Caldowd98 ,

I don´t reccomend you to limit the rows of your calendar table to the last date of your fact table. You can have problems with time intelligence functions.

 

See here how a calendar table must be written:

https://community.powerbi.com/t5/Community-Blog/Time-Intelligence-Calendar-Table/ba-p/1000565

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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