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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

count no of days in a row having work days

Hello

 

I would like to calculate the days from the below workday list.

 

The result should be 5.

 

Thank you

 

Workdays

01-Jan-2023
03-Jan-2023
01-jan-2023
04-Jan-2023
04-Jan-2023
04-Jan-2023
05-Jan-2023
06-Jan-2023
06-Jan-2023
06-jan-2023
1 ACCEPTED SOLUTION

Hi @Anonymous 

I think I understand.

Would this help?

 

zCount = DISTINCTCOUNT( 'Workdays'[Workday] )
 

Let me know if I'm misunderstanding your post.

 

View solution in original post

6 REPLIES 6
Padycosmos
Solution Sage
Solution Sage

Hope this helps:

Padycosmos_0-1677843195209.png

 

 

 

grantsamborn
Solution Sage
Solution Sage

Hi @Anonymous 

I'm not sure how you arrive at a result of 5.

Since a) there was no "02-Jan-2023" and b) having a span of 6 days would include a weekend day, I would like you to explain your expected result of 5 workdays in a row.

 

(Edited to add:  Part b) is actually irrelevant since if there is 1 day off inside of any 6 day period, the maximum would be 4 days in a row - regardless of if they are working days or not.)

Hello grantsmborn

 

My requirement is to count no days and need to be excluded if the date is repeated. In the example if you consider 1-Jan-2023,3-Jan-2023,4-Jan-2023,5-jan-2023 ,6-Jan-2023 so total 5 days.

Hi @Anonymous 

I think I understand.

Would this help?

 

zCount = DISTINCTCOUNT( 'Workdays'[Workday] )
 

Let me know if I'm misunderstanding your post.

 

Padycosmos
Solution Sage
Solution Sage

Hope this helps:

Padycosmos_0-1677784600278.png

 

Andy1984
Frequent Visitor

@Anonymous 

 

I do not know your data set. for example you can try it with a measure like this:

 

count_workdays = NETWORKDAYS( DATE(2022,10,1), //start date

                                                          DATE(2022,10,31), //end date

                                                          7 )

 

Counts the days between the start date and end date, ignoring weekend days. 

 

7 = Friday and Saturday 

8 = Saturday and Sunday 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.