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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
IPGeorgiev
Helper III
Helper III

Count consecutive days on a specific status

Hi All,

 

I want to count the number of consecutive days for each attendance status for a specific employee. So here an example of the data:

 

Emp IdEmp NameProject IdProgramDateSchedule  Status
111111Max Mustermann55Test Progrma07/01/2021Off
111111Max Mustermann55Test Progrma07/02/2021Work
111111Max Mustermann55Test Progrma07/03/2021Work
111111Max Mustermann55Test Progrma07/04/2021Work
111111Max Mustermann55Test Progrma07/05/2021Work
111111Max Mustermann55Test Progrma07/06/2021Work
111111Max Mustermann55Test Progrma07/07/2021Work
111111Max Mustermann55Test Progrma07/08/2021Off
111111Max Mustermann55Test Progrma07/09/2021Off
111111Max Mustermann55Test Progrma07/10/2021Work
111111Max Mustermann55Test Progrma07/11/2021Work
111111Max Mustermann55Test Progrma07/12/2021Work
111111Max Mustermann55Test Progrma07/13/2021Work
111111Max Mustermann55Test Progrma07/14/2021Work
111111Max Mustermann55Test Progrma07/15/2021Work
111111Max Mustermann55Test Progrma07/16/2021Work
111111Max Mustermann55Test Progrma07/17/2021Off
111111Max Mustermann55Test Progrma07/18/2021Off
111111Max Mustermann55Test Progrma07/19/2021Work
111111Max Mustermann55Test Progrma07/20/2021Work
111111Max Mustermann55Test Progrma07/21/2021Work
111111Max Mustermann55Test Progrma07/22/2021Work
111111Max Mustermann55Test Progrma07/23/2021Work
111111Max Mustermann55Test Progrma07/24/2021Off
111111Max Mustermann55Test Progrma07/25/2021Off
111111Max Mustermann55Test Progrma07/26/2021Unscheduled
111111Max Mustermann55Test Progrma07/27/2021Unscheduled
111111Max Mustermann55Test Progrma07/28/2021Unscheduled
111111Max Mustermann55Test Progrma07/29/2021Unscheduled
111111Max Mustermann55Test Progrma07/30/2021Unscheduled
111111Max Mustermann55Test Progrma07/31/2021

Unscheduled

 

So as on output I want to have a matrix where under ROWs I will put - > Emp Name/Schedule Status and under values - the max consecutive days for each status. So the output will be for this case:

 

Name/ScheduleStatusMax Consecutive
Max Mustermann 
"-Work"7
"-OFF"2
"-UNSCHEDULED"6

 

I would really appreciate if someone can help me with this - at a first glance it looks rather easy, but turns out to be quite hard, at least for me.

 

Thanks in advance!!

 

BEst regards,
Ivan

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Picture1.png

 

Link to the PBIX file 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Picture1.png

 

Link to the PBIX file 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Worked perfectly!! Many thanks!

 

Just 1 question - what is the use of the index column in the Schedule Status table?

Thank you for your feedback.

The column - Work/Off/Unscheduled column - is sorted by Index column.

It does not have a problem with not having the index column. But the visualization would be shown like below.

Off / Unscheduled / Work ( alphabetical order)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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