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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not applicable

Cumulative SUM of working days

Hi community,

 

I need to calculate cumulative count of working days for the same period in last year .I already have a script which works fine for the current year , however can't get it done for the last year . In the screenshot attached,in PowerBI i filtered for 2023 year and calculation works fine . I want a measure which do the same for the same period in last year ,to put next to him.Thanks in advance.

My script  : 

Measure CurrentWorkingDays =
VAR CurrentDate = MAX('Календарь'[DayDate])
VAR SelectedMonth = MAX('Календарь'[MonthNo])

VAR WorkingDaysPast =
    CALCULATE(
        COUNTROWS('Календарь'),
        FILTER(
            ALLSELECTED('Календарь'),
            'Календарь'[DayDate] <= CurrentDate
                && 'Календарь'[MonthNo] = SelectedMonth
                && 'Календарь'[DayIsHolyday] = 0
        )
    )
    RETURN WorkingDaysPast

 

Shaxa_0-1688473786209.png

 

2 REPLIES 2
Anonymous
Not applicable

Hi,

 

Thanks for your quick response. It shows "Parameter is not the correct type" indicating to CurrentDate variable. 

confidentnwrong
Advocate I
Advocate I

Hello,

Assuming 'Календарь'[DayDate] is the whole date (eg 01/01/2023), here's how to adapt your measure up until the same date last year, using PARALLELPERIOD

 

Measure WorkingDaysLastYear =
VAR CurrentDate = MAX('Календарь'[DayDate])
VAR SelectedMonth = MAX('Календарь'[MonthNo])

VAR WorkingDaysPast =
    CALCULATE(
        COUNTROWS('Календарь'),
        FILTER(
            ALLSELECTED('Календарь'),
            'Календарь'[DayDate] <= PARALLELPERIOD(CurrentDate, 1, YEAR)
                && 'Календарь'[MonthNo] = SelectedMonth
                && 'Календарь'[DayIsHolyday] = 0
        )
    )
    RETURN WorkingDaysPast

 

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.