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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
gauravnarchal
Post Prodigy
Post Prodigy

Count Weekends

I want to count the weekend (Fri & Sat) as of today.  How can I add "as of today" to the below measure so I can get the desired result count 1?

 

_weekendcountasoftoday =

CALCULATE(

    COUNTROWS('Calendar'), all('Calendar'), 'Calendar'[WeekdayWeekend] = "Weekend")

 

Calendar Table

 

MonthYearWeekdayNumberDateWeekdayWeekendWeekday
Apr-22501-04-22 0:00WeekdayFri
Apr-22602-04-22 0:00WeekendSat
Apr-22003-04-22 0:00WeekendSun
Apr-22104-04-22 0:00WeekdayMon
Apr-22205-04-22 0:00WeekdayTue
Apr-22306-04-22 0:00WeekdayWed
Apr-22407-04-22 0:00WeekdayThu
Apr-22508-04-22 0:00WeekdayFri
Apr-22609-04-22 0:00WeekendSat
Apr-22010-04-22 0:00WeekendSun
Apr-22111-04-22 0:00WeekdayMon
Apr-22212-04-22 0:00WeekdayTue
Apr-22313-04-22 0:00WeekdayWed
Apr-22414-04-22 0:00WeekdayThu
Apr-22515-04-22 0:00WeekdayFri
Apr-22616-04-22 0:00WeekendSat
Apr-22017-04-22 0:00WeekendSun
Apr-22118-04-22 0:00WeekdayMon
Apr-22219-04-22 0:00WeekdayTue
Apr-22320-04-22 0:00WeekdayWed
Apr-22421-04-22 0:00WeekdayThu
Apr-22522-04-22 0:00WeekdayFri
Apr-22623-04-22 0:00WeekendSat
Apr-22024-04-22 0:00WeekendSun
Apr-22125-04-22 0:00WeekdayMon
Apr-22226-04-22 0:00WeekdayTue
Apr-22327-04-22 0:00WeekdayWed
Apr-22428-04-22 0:00WeekdayThu
Apr-22529-04-22 0:00WeekdayFri
Apr-22630-04-22 0:00WeekendSat

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @gauravnarchal 

 

You can try the following methods.

_weekendcountasoftoday = 
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    FILTER (
        ALL ( 'Calendar' ),
        [WeekdayWeekend] = "Weekend"
            && [Date] <= TODAY ()
            && [Monthyear] = SELECTEDVALUE ( 'Calendar'[Monthyear] )
    )
)

The day I replied to you is April 5, and the weekend count should be 2.

vzhangti_0-1649142661413.png

When I replace today with April 2nd as you asked, I get the result you were expecting before with the number 1.

vzhangti_1-1649142836967.png

This should be your desired outcome.

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

6 REPLIES 6
v-zhangti
Community Support
Community Support

Hi, @gauravnarchal 

 

You can try the following methods.

_weekendcountasoftoday = 
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    FILTER (
        ALL ( 'Calendar' ),
        [WeekdayWeekend] = "Weekend"
            && [Date] <= TODAY ()
            && [Monthyear] = SELECTEDVALUE ( 'Calendar'[Monthyear] )
    )
)

The day I replied to you is April 5, and the weekend count should be 2.

vzhangti_0-1649142661413.png

When I replace today with April 2nd as you asked, I get the result you were expecting before with the number 1.

vzhangti_1-1649142836967.png

This should be your desired outcome.

 

Best Regards,

Community Support Team _Charlotte

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

ryan_mayu
Super User
Super User

@gauravnarchal 

maybe try

CALCULATE(

    COUNTROWS('Calendar'), all('Calendar'), 'Calendar'[WeekdayWeekend] = "Weekend" && ‘Calendar'[Date]<=today() )





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu  - I am not getting the result using this measure. When I select the month April’22 in the slicer, I am getting the result as 861 which is YTD instead of 1 as this month (April 22) today is the first weekend.

Ashish_Mathur
Super User
Super User

Hi,

This measure works

=CALCULATE(COUNTROWS('Calendar'),'Calendar'[WeekdayWeekend]="Weekend",DATESBETWEEN('Calendar'[Date],MINX(all('Calendar'),'Calendar'[Date]),today()))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur  - It gives me the count of the weekend results as YTD. How can I get the result weekend result for MTD as of today?

gauravnarchal_0-1648886158357.png

 

Hi,

What do you mean by MTD as of today and how can the answer be 26?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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