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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Cumulative sum of a measure

I have a measure that calc. the difference between 2 columns 

Delta= ABS([CreatedCases]-[ClosedCases])

now i would like to sum the delta column

is it really not possible to create a cumulative sum of a measure?? 

 

deltacc.PNG

 

2 ACCEPTED SOLUTIONS

@Anonymous

How about something like this?

Delta Running Total MEASURE = 
CALCULATE (
    SUMX (
        SUMMARIZE (
            'Table',
            'Table'[Index],
            "ABS to SUM", ABS ( SUM ( 'Table'[CRs Raised] ) - SUM ( 'Table'[CRs Closed] ) )
        ),
        [ABS to SUM]
    ),
    FILTER ( ALL ( 'Table' ), 'Table'[Index] <= MAX ( 'Table'[Index] ) )
)

SUMX - ABS - Running Total Measure.png

Good Luck! Smiley Happy

View solution in original post

Hi @Anonymous,

 

Try this calculated field formula

 

=CALCULATE(SUMX(SUMMARIZE('Calendar','Calendar'[Month],"ABCD",ABS([CreatedCases]-[ClosedCases])),[ABCD]),DATESYTD('Calendar'[Date],"31/12"))

Download the file from here.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

13 REPLIES 13
Sean
Community Champion
Community Champion

@Anonymous

Your Measure calculates (in the Total Row) the absolute value of the difference of the Totals of both columns

Use an iterator instead - SUMX in this case

This way you will get the absolute value on each row and then the sum of all results in the total row

Delta = SUMX ( 'Table', ABS ( 'Table'[CRs Closed] - 'Table'[CRs Raised] ) )

Hope this helps! Smiley Happy

Anonymous
Not applicable

no unfortunatly , this is what i get - see the last column

the result should be 21 and then 48 etc. 

 

edltatest.PNG

Hi @Anonymous,

 

Try this calculated field formula

 

=CALCULATE(SUMX(SUMMARIZE('Calendar','Calendar'[Month],"ABCD",ABS([CreatedCases]-[ClosedCases])),[ABCD]),DATESYTD('Calendar'[Date],"31/12"))

Download the file from here.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

And this works as well , thanks

Hi @Anonymous,

 

Do you have in your data a columns like Index or date.

I can use it to create the running sum.

 

Please let us know.

 

Ninter.

 

 

Anonymous
Not applicable

yes i have a date column

Hi @Anonymous,

 

So please give us a sample data with the date and the other column and then I will compute the measure or column.

 

Thank you.

 

Ninter

Anonymous
Not applicable

Sean
Community Champion
Community Champion

@Anonymous

Place Date from your Calendar in the Rows (keep only Year and Month from the resulting Hierarchy)

 

Delta Running Total MEASURE =
CALCULATE (
    SUMX (
        SUMMARIZE (
            'Calendar',
            'Calendar'[YearMonth],
            "ABS to SUM", ABS ( [CreatedCases] - [ClosedCases] )
        ),
        [ABS to SUM]
    ),
    FILTER (
        ALLSELECTED ( 'Calendar' ),
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    )
)

 

SUMX - ABS - Running Total Measure 2.png

 

Hope this works and helps! Smiley Happy

Anonymous
Not applicable

thanks a lot this works

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Anonymous

How about something like this?

Delta Running Total MEASURE = 
CALCULATE (
    SUMX (
        SUMMARIZE (
            'Table',
            'Table'[Index],
            "ABS to SUM", ABS ( SUM ( 'Table'[CRs Raised] ) - SUM ( 'Table'[CRs Closed] ) )
        ),
        [ABS to SUM]
    ),
    FILTER ( ALL ( 'Table' ), 'Table'[Index] <= MAX ( 'Table'[Index] ) )
)

SUMX - ABS - Running Total Measure.png

Good Luck! Smiley Happy

Anonymous
Not applicable

Nope doesn't work either The problem is that CR raised and CR Closed are both measures CR Closed= Calculate([CountCases];CR[Type] ="Case Closed date") CR Raised = Calculate([CountCases];CR[Type] ="Created on") and apparently it is not possible to sum on a measure - as far as i can understand

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.