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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Ranking by Total Sum, then Creating Cumulative Running Total to determine coverage %

Hi All - 

 

I have been trying to understand what I am doing wrong for several days and am struggling.

 

I built a simple dummy data table to show my general approach:

Item  Group Value Date

AA8Saturday, January 1, 2022
BB4Saturday, January 1, 2022
CC19Saturday, January 1, 2022
DA45Sunday, January 1, 2023
EB71Friday, January 6, 2023
FC84Wednesday, January 11, 2023
GA70Monday, January 16, 2023
HB58Saturday, January 21, 2023
IC38Thursday, January 26, 2023
JA29Tuesday, January 31, 2023
KB62Sunday, February 5, 2023
LC44Friday, February 10, 2023
MA91Wednesday, February 15, 2023
NB77Monday, February 20, 2023
OC16Saturday, February 25, 2023
PA81Thursday, March 2, 2023
QB19Tuesday, March 7, 2023
RC10Sunday, March 12, 2023
SA33Friday, March 17, 2023
TB48Wednesday, March 22, 2023
UC14Monday, March 27, 2023
VA47Saturday, April 1, 2023
WB91Thursday, April 6, 2023
XC81Tuesday, April 11, 2023
YD19Sunday, April 16, 2023
Z 41Friday, April 21, 2023

 

From this Dummy Table, it is my intention to take a filtered Group Sum, Rank that Group Sum by Size relative to Group, then create a cumulative sum by order of ranking (eventually establishing what categories by order of largest to smallest I would need to include to select 70% of the population, then the next 20%, and then the final 10%).

 

I have built the following measures so far:

SegmentSpendLast6MonthsExcludingSamples =
CALCULATE(
    SUM('Sheet1'[Value]),
    FILTER(
        Sheet1,
        YEAR('Sheet1'[Date]) >= 2023 &&
        NOT(ISBLANK('Sheet1'[Group]))
    )
)

SegmentRank = RANKX(ALL('Sheet1'[Group]), [SegmentSpendLast6MonthsExcludingSamples], , DESC)


SegmentCategory =
VAR SegmentSpend = [SegmentSpendLast6MonthsExcludingSamples]
VAR CurrentSegmentRank = [SegmentRank]
VAR CurrentGroup = MAX('Sheet1'[Group])
VAR CumulativeRank =
SUMX(
    FILTER(
    ALL('Sheet1'),
    'Sheet1'[Group] = CurrentGroup &&
    [SegmentRank]<=CurrentSegmentRank
    ),
    [SegmentSpendLast6MonthsExcludingSamples]
    )
VAR CumulativePercent = CumulativeRank / SegmentSpend
 
RETURN
 
CumulativeRank

My Table Visual currently shows:
SegmentSpendLast6MonthsExcludingSamplesGroupSegmentRankSegmentCategory
426B1426
396A2396
287C3287
19D419
  5 

My intent is to show the following:
SegmentSpendLast6MonthsExcludingSamplesGroupSegmentRankSegmentCategoryCumulative %Sampling Group
426B142638%Top 70%
396A282273%Top 70%
287C3110998%Next 20%
19D41128100%Final 10%
  51128100% 

I have yet to build a sampling group measure or a full cumulative % measure, but I know I need my cumulative sum measure/SegmentCategory to work first.

Any help would be much appreciated, I gone round and round with ChatGPT trying to understand what is missing here.

 

2 REPLIES 2
lbendlin
Super User
Super User

lbendlin_0-1696898427938.png

 

Why would Group A be in the Top 70% ?

 

 

Anonymous
Not applicable

Thanks for the response, the report user had asked for the grouping to be made to include the segment that triggers the 70% threshold to be met.

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.