cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
atjt217
Helper II
Helper II

Count of days YTD and Year w/o Weekends

Hello, 

I would like to ask your help to figure out the measure formula i can use to obtain the results highlighted in Yellow. The YTDnoWeekends shows the count of weekdays each month however for the current month it only counts the days till yesterday (12/6). The YEAR woWeekends is the count of days per month for the whole year without the weekends. 

 

atjt217_0-1638908178341.png

I appreciate your help. 

 

 

1 ACCEPTED SOLUTION
mahoneypat
Super User
Super User

Here are two measure expressions that should work. Replace 'Date'[Date] with your actual date column.

 

YearNoWeekends =
CALCULATE (
COUNT ( 'Date'[Date] ),
FILTER (
VALUES ( 'Date'[Date] ),
WEEKDAY ( 'Date'[Date] ) IN { 2, 3, 4, 5, 6 }
)
)
 
YTDNoWeekends =
CALCULATE (
COUNT ( 'Date'[Date] ),
FILTER (
VALUES ( 'Date'[Date] ),
'Date'[Date] <= TODAY ()
&& WEEKDAY ( 'Date'[Date] ) IN { 2, 3, 4, 5, 6 }
)
)
 
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Here's another approach.  Write this calculated column formula in the Calendar Table

Weekday number = weekday(Calendar[Date],2)

Write this measure

Measure1 = calculate(countrows(Calendar),Calendar[Weekday number]<=5)

Ensure that the month name field in your visual has been dragged from the Calendar Table.  Please also ensure that one year has been selected in the Year slicer (which in turn should be from the Calendar Table).

Hope this helps.


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

Here are two measure expressions that should work. Replace 'Date'[Date] with your actual date column.

 

YearNoWeekends =
CALCULATE (
COUNT ( 'Date'[Date] ),
FILTER (
VALUES ( 'Date'[Date] ),
WEEKDAY ( 'Date'[Date] ) IN { 2, 3, 4, 5, 6 }
)
)
 
YTDNoWeekends =
CALCULATE (
COUNT ( 'Date'[Date] ),
FILTER (
VALUES ( 'Date'[Date] ),
'Date'[Date] <= TODAY ()
&& WEEKDAY ( 'Date'[Date] ) IN { 2, 3, 4, 5, 6 }
)
)
 
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Power BI Show Ep 4 Post Show Carousel.jpg

The Power BI Community Show

Shabnam Watson demos Incremental refresh & Hybrid Tables and Leila Etaati demos Charticulator.

PBI April Release 2022 768x460.png

Check it out!

Click here to read more about the April 2022 updates!

Power BI Dev Camp Session 22 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!