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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Housden996
Helper II
Helper II

Sum of consecutive fails

Hi 

 

I am using the following dax to get thefollowing

Measure

Fail Count = 
VAR __CurrIndex = SELECTEDVALUE( 'Date'[Index] )
VAR __SelectedPeriodWithFail = 
   CALCULATE(
        MAXX(
            FILTER(
                ADDCOLUMNS( VALUES( 'Date'[Index]) , "@failcount" , [Sum of Fail Validations] ),
                [@failcount] <> 1 && 'Date'[Index] < __CurrIndex
            ),
            'Date'[Index]
        ),
        ALLSELECTED( 'Date' )
    )
    
VAR __Gap =  FILTER( ALLSELECTED( 'Date'[Index]),'Date'[Index] <= __CurrIndex && 'Date'[Index] > __SelectedPeriodWithFail )

RETURN
   IF( [Sum of Fail Validations] = 1 , COUNTROWS( __Gap ) , BLANK() )

This gives me the output:

Housden996_0-1707145562259.png

 

This output is incorrect, I need to get the caclulation to output the following:

Housden996_1-1707145562261.png

 

So if there are multiple tests in a month the consecutive fail is counted as 1 still and if there is no data for the previous month the fail count resets to 0. 

What do i need to change in my calculated column / create a new measure to make this correct? I am totally lost, I have tried to reallign agaisnt the period table but I havnt had much luck.

 

This used to work for a single instence but now it does.

 

I need to get this so in the table on the bottom left, attached to this post to show the sites consecutive running strikes.

 

I got some aid in the past form a user to get the DAX working for a single site but I never managed to get this working for multiple sites.

 

Can any one help me get this issue boxed off. Its been bugging me for months!

5 REPLIES 5
Housden996
Helper II
Helper II
Greg_Deckler
Community Champion
Community Champion

@Housden996 Sounds like Cthulhu. Cthulhu - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  thanks for the response, I have attempted to use the cathulhu v2 calculated column DAX and a measure unfortunatly this didnt work. 

 

I have tried to use my period as the index but the different ways I have aggregated the calculated column the answers are wrong and for some reason the DAX is pulling in a 1 value when there is no fail. 

Examples bellow:

This is for S4

Housden996_0-1707220260763.png

Showing a SUM and MAX of 2 when the Sum/ Max is 4 Fails in a row

Housden996_1-1707220424656.png

So the Cathulhu value for S4 should be 4.

 

I think this is simlar to the solution you have posted but not the same.

 

Any suggestions?

@Housden996 Post some sample data as text and I'll see what I can do.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler thank you here is a link to the data as I dont have the karma to upload a pbix file:
https://drive.google.com/file/d/1foi4kysvToEN5McUSSzcxSSON_EjBDO0/view?usp=drive_link

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.