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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Srinivas3350
Helper II
Helper II

Need a urgent help in DAX for calender

I am  having a calender where the last friday of the month is end of the month so i am using some DAX to show current month filter in some reports but oct 27th is the last day of the month end  and from 28th oct should come in november. I am using a DAX where it is showing current month untill 31st oct. can anyone help me please.

 

 

CurrentMonthFlag_v1 =
VAR CurrentYYMM = FORMAT(TODAY(), "YYMM")
RETURN
    IF('DATE'[Fin_YYMM] = CurrentYYMM, 1, 0)

Thanks
Srinivas
2 REPLIES 2
Anonymous
Not applicable

Hi @Srinivas3350 ,

 

Please try code as below to create a calendar table.

Calendar = 
VAR _STEP1 =
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2023, 01, 01 ), DATE ( 2023, 12, 31 ) ),
        "Year", YEAR ( [Date] ),
        "Month", MONTH ( [Date] ),
        "YearMonth",
            YEAR ( [Date] ) * 100
                + MONTH ( [Date] ),
        "MonthName", FORMAT ( [Date], "MMMM" ),
        "WeekDay", WEEKDAY ( [Date], 2 ),
        "WeekDayName", FORMAT ( [Date], "DDDD" )
    )
VAR _STEP2 =
    ADDCOLUMNS (
        _STEP1,
        "Fiscal Year",
            VAR _LASTFRIDAY =
                MAXX (
                    FILTER ( _STEP1, [YearMonth] = EARLIER ( [YearMonth] ) && [WeekDay] = 5 ),
                    [Date]
                )
            RETURN
                IF ( [Date] <= _LASTFRIDAY, [Year], YEAR ( EOMONTH ( [Date], +1 ) ) ),
        "Fiscal Month",
            VAR _LASTFRIDAY =
                MAXX (
                    FILTER ( _STEP1, [YearMonth] = EARLIER ( [YearMonth] ) && [WeekDay] = 5 ),
                    [Date]
                )
            RETURN
                IF ( [Date] <= _LASTFRIDAY, [Month], MONTH ( ( EOMONTH ( [Date], +1 ) ) ) )
    )
RETURN
    _STEP2

Result is as below.

vrzhoumsft_0-1698991159523.png

 

Best Regards,
Rico Zhou

 

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

Hi @Anonymous , Thank you. I am already having this fiscal calender years but my measure is not working to show current fiscal month. could you help me in this measure to show current fiscal month. if it is current fiscal month 1 or 0

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.