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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
YogeshS
Frequent Visitor

calculating the consecutive count

Hello,

 

YogeshS_0-1685959586880.png

I am trying to calculate the consecutive absent count of students......like they should be absent for 7 days continuously then the dax should take the count as 1 and if another student is asbsent for continuous 7 days then, dax should increase its count to 2. I have attached the above picture for reference. Consider Dates are stacked in one single column,  in the above picture i divided the date into columns for easy understanding.
Help me to create a measure/ calculated column.

3 REPLIES 3
YogeshS
Frequent Visitor
YogeshS
Frequent Visitor

Hi @v-jianboli-msft ,

Thank you for your help,
But my data seems to be big, i am getting the below error after implementing your measure.

YogeshS_1-1686297913104.png

Could you please help me with this?

v-jianboli-msft
Community Support
Community Support

Hi @YogeshS ,

 

Please try:

Measure =
VAR _a =
    COUNTX ( FILTER ( 'Table', [Value] = 0 ), [Date] )
VAR _b =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[ID] ),
        FILTER (
            FILTER ( ALL ( 'Table' ), [ID] <= MAX ( 'Table'[ID] ) ),
            COUNTX (
                FILTER ( ALL ( 'Table' ), [ID] = EARLIER ( 'Table'[ID] ) && [Value] = 0 ),
                [Date]
            ) = 7
        )
    )
RETURN
    IF ( _a = 7, _b )

Final output:

vjianbolimsft_0-1686105327258.png

Best Regards,

Jianbo Li

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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