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! Learn more

Reply
Anonymous
Not applicable

Finding Consecutive number and counting

Hi,

 

I have attached data set and expected output as well, but not sure how to get the perfect DAX to find the consecutive number and counting.

 

Pls refer the below and let me know how is this feasible.

 

Sr NoDateNameStatus
11/11/2022ABCPresent
22/11/2022ABCPresent
33/11/2022ABCAbsent
44/11/2022ABCAbsent
55/11/2022ABCAbsent
65/12/2022ABCAbsent
75/13/2022ABCPresent
85/14/2022ABCAbsent
95/15/2022ABCAbsent
101/11/2022DEFPresent
112/11/2022DEFAbsent
123/11/2022DEFAbsent
134/11/2022DEFPresent
145/11/2022DEFPresent
155/12/2022DEFAbsent
165/13/2022DEFAbsent
175/14/2022DEFPresent
185/15/2022DEFPresent

 

NameConsecutive Absent 2Consecutive Absent 3Consecutive Absent 3 plus
ABC101
DEF200

Thanks,

2 REPLIES 2
Anonymous
Not applicable

I want to see consecutive count of number of absent like total number of absent by student absent continiously 2 times, 3 times and 3 plus times. so that I can focus on the student who are absent frequently continiously.

 

Ex: ABC is continiously absent 4 times from March 11 to May 12. Absent 2 times from May 14th May 15

         3 plus   2 times

ABC      1          1

DEF       0          2

 

Any solution pls.

v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

Do you want to count the number of consecutive absences or the length of each absence, grouped by name? Would the following formula be helpful to you.

a =
VAR next_ =
    TOPN (
        1,
        FILTER (
            'Table',
            'Table'[Sr No] < EARLIER ( 'Table'[Sr No] )
                && 'Table'[Name] = EARLIER ( 'Table'[Name] )
        ),
        [Sr No], DESC
    )
VAR next_status =
    MINX ( next_, [Status] )
RETURN
    IF ( 'Table'[Status] = "Absent" && 'Table'[Status] = next_status, "yes", "no" )

vhenrykmstf_0-1668676104717.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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