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
Salle
Helper I
Helper I

Inaccurate Cumulative Sum

Hi, having trouble getting the cumulative sum accurate. Filter issue?

 

Setup:
Two tables: 'Rerun'[RejectCodeID];[Units]  and 'Scrap'[RejectCodeID]; [Units].

One to many: Dimension table 'RejectCode'[RejectCodeID]

The Dax measure I use calculates the cumulative sum of rejects incorrectly after 116.
It sould been 35, 57, 77, 93, 105, 117, 118, 119, 120, 121, 122.

Salle_0-1698668522477.png

Cumulative Rejects = 

VAR TotalRejects = [Reruns] + [Scrap]

Return

SUMX(
    FILTER(
        SUMMARIZE( ALLSELECTED('RejectCode'), 'RejectCode'[RejectCodeID], 
        "Rejects", [Scrap] + [Reruns] ),
         [Rejects] >= TotalRejects ),
         [Rejects] )

Any ideas on what can be wrong?


Thanks! 

1 ACCEPTED SOLUTION
v-tianyich-msft
Community Support
Community Support

Hi @Salle ,

 

I'm suspecting you're trying to accumulate based on total largest to smallest, and you can check the results as follows:

vtianyichmsft_0-1698827420910.png

Rank = 
VAR _1=RANKX('Table (2)','Table (2)'[Total],,DESC,Dense) 

VAR _2 =
RANKX('Table (2)','Table (2)'[RejectCodeID],,ASC,Dense)/ POWER(10,ROUNDDOWN(COUNT('Table (2)'[RejectCodeID])/10,0)+1)
RETURN
_1 + _2

Cumulative Rejects = 
VAR TotalRejects = [Re] + [Sc]
Return
CALCULATE(
    SUM('Table (2)'[Total]),
    FILTER(
        ALLSELECTED('Table (2)'),
        'Table (2)'[Rank] <= MAX('Table (2)'[Rank])
    )
)

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

View solution in original post

3 REPLIES 3
v-tianyich-msft
Community Support
Community Support

Hi @Salle ,

 

I'm suspecting you're trying to accumulate based on total largest to smallest, and you can check the results as follows:

vtianyichmsft_0-1698827420910.png

Rank = 
VAR _1=RANKX('Table (2)','Table (2)'[Total],,DESC,Dense) 

VAR _2 =
RANKX('Table (2)','Table (2)'[RejectCodeID],,ASC,Dense)/ POWER(10,ROUNDDOWN(COUNT('Table (2)'[RejectCodeID])/10,0)+1)
RETURN
_1 + _2

Cumulative Rejects = 
VAR TotalRejects = [Re] + [Sc]
Return
CALCULATE(
    SUM('Table (2)'[Total]),
    FILTER(
        ALLSELECTED('Table (2)'),
        'Table (2)'[Rank] <= MAX('Table (2)'[Rank])
    )
)

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

Thennarasu_R
Responsive Resident
Responsive Resident

Hi @Salle 

Try this measure ,

Measure=Calculate (Rejects+Scraps,Filter(All(Dimdate),Date column<=Max(Date))

Thanks,
Thennarasu R
If this post helps then please consider accepeted the solution  to help the other members find it more quickly. 


It does not work.
I want to plot a pareto chart with RejectionCodeID as bars and Pareto curve as line. But first the cumulative sum must be accurate.

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.