Reply
MSuser5
Helper III
Helper III

create calendar based on source date

Hi All,

 

I have source file dates starting from 31/01/2021 to till yesterday ( November 7th 2023) as i have created calendar table based source first date and lastdate.

But while using into calendar date as in slicer it's appearing  till December 2023.

 

calender = CALENDAR(FIRSTDATE('For Loading'[Day]), LASTDATE('For Loading'[DAY]))
 
Issue below :
Capture1.PNG
 
 
Kindly suggest how to avoid and get till last date of source file.
 
Thanks,
MS
1 ACCEPTED SOLUTION

you disable this option

Screenshot_1.png

View solution in original post

6 REPLIES 6
Ahmedx
Super User
Super User

try this

Calendar = 
VAR BaseCalendar =
    CALENDAR (MIN('For Loading'[DAY]) , MAX('For Loading'[DAY]))
RETURN
    GENERATE (
        BaseCalendar,
        VAR BaseDate = [Date]
        VAR YearDate = YEAR ( BaseDate )
        VAR MonthNumber = MONTH ( BaseDate )
        VAR YearMonthNumber = YearDate * 12 + MonthNumber - 1
        RETURN ROW (
            "Year", YearDate,
            "Month Number", MonthNumber,
            "Month", FORMAT ( BaseDate, "mmmm"),
            "Year Month Number", YearMonthNumber,
            "Year Month", FORMAT ( BaseDate, "mmm yy")
        )
    )

Hi @Ahmedx ,

 

Still no luck FYI,

Capture1222.PNG

if it doesn’t work, check your data, it’s all there December

you disable this option

Screenshot_1.png

Idrissshatila
Super User
Super User

@MSuser5 ,

 

can you try min and max instead of startdate and lastdate.

 

can you also make sure from the data view that there's no record for december.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




@Idrissshatila ,

I'm sure there is no data for december  and i have tried for MIN , MAX condition but no luck.

FYI,

Capture12.PNG

 

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)