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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
atjt217
Helper III
Helper III

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
Employee
Employee

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
Employee
Employee

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.