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 or Sum of Unique Key Column but Restart when Sequence Interrupted

This is my very first post, so please excuse any newbie mistakes.  I have been working on my issue for over a week and have tried many solutions, but none have worked.  I am building Control Charts and I am attempting to identify patterns in the date and I am trying to count occurences but need to restart the count when a unique key is interrupted.  See below.

 

I am trying to count the number of KEY rows in sequence, but need it to restart the count when a different key appears. I would like the formula to be a calculated column.  As you can see I have it summing ALL of the KEY as "SUMA" and EACh of the KEY as "SUMM".  You can see that the data is in numerial order using WkYearNum and always will be.  Any help is appreciated. If I need to post something else to help please let me know?

 

 

 

TempPic.PNG

5 REPLIES 5
Anonymous
Not applicable

I forgot to mention. The numbers written in RED are the desired result. In some cases this will go up to 16. It just depends on data.  The total column is grouped by quarter.

Anonymous
Not applicable

Correction: It should read "patterns in the data"...NOT date.

Can you show your current formulas for SUMA and SumM?

Anonymous
Not applicable

Yes.  But I had to also add a few columns I left out so they make sense. See below.

 

 

TempPic1.PNG

 

SUMA = CALCULATE(
SUM( Control_Chart_Sample_Size_Temp[Valid_Zone_CL]),
FILTER( ALL(Control_Chart_Sample_Size_Temp) ,
SUMX( FILTER(Control_Chart_Sample_Size_Temp, EARLIER(Control_Chart_Sample_Size_Temp[KEY]) = Control_Chart_Sample_Size_Temp[KEY] ), Control_Chart_Sample_Size_Temp[Valid_Zone_CL])
)
)

 

SumM = VAR m = [Equalizer_Zone_CLB]
RETURN
CALCULATE ( SUM( Control_Chart_Sample_Size_Temp[Valid_Zone_CL] ), FILTER (Control_Chart_Sample_Size_Temp,m ) )

Anonymous
Not applicable

EQUALIZER_ZONE_CLB is a measure that tries to use the MAX of WkYearNum to create a new unique key, but this measure doesnt work either.

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.