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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
claudirnava
Frequent Visitor

Cumulative sum calculated field

Hello

 

I want to create a cumulative sum but the ammount that I´m intended to use is a calculated field. I´m not wokinr with date because I just want to sum the ammounts once they are sorted in descendent order. "Participación Total" is the field used to sort the data, and I want to create a cumulative sum for the field "MAT" all the date are calcualted fields.

claudirnava_0-1719400181019.png

@amitchandak could you help me?
 
4 REPLIES 4
claudirnava
Frequent Visitor

Hello Yilong

 

The problem that I have is that the measure [MAT] is a calculated field is not part of the table, so I tried to calculate a cummulative sum of a calculated field. This is the expression that I used to calculated the MAT:

 

MAT = CALCULATE(
    SUM( 'Consumos Onco'[Measure Values] ),
    DATESINPERIOD( calendario[Date] , MAX( calendario[Date] ) , -12 , MONTH )
)
 
And I want to crate the cummulate sum of "Participacion Total" this is the expression:
Participacion Total = DIVIDE([MAT],
    CALCULATE (
        SUM ( 'Consumos Onco'[Measure Values] ),
        FILTER ( ALL ( 'Consumos Onco' ), [Measure Names] = "Consumo" ),DATESINPERIOD( calendario[Date] , MAX( calendario[Date] ) , -12 , MONTH )
    ))
 
The proble is that I dont know how to calcualte a cummulative sum of a calculated field
Anonymous
Not applicable

Hi @claudirnava ,

Maybe I think you can try this DAX code.

Cumulative MAT = 
CALCULATE(
    SUM('YourTableName'[MAT]),
    FILTER(
        ALLSELECTED('YourTableName'),
        'YourTableName'[Participación Total] >= MIN('YourTableName'[Participación Total])
    )
)

This measure will calculate the running total of “MAT” for each row, considering all previous rows with a higher or equal value of “Participación Total”.

If it does not help you, you can provide more details and .pbix file for me.

 

 

 

Best Regards

Yilong Zhou

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

@Anonymous 

Hello Yilong

 

The problem that I have is that the measure [MAT] is a calculated field is not part of the table, so I tried to calculate a cummulative sum of a calculated field. This is the expression that I used to calculated the MAT:

 

MAT = CALCULATE(
    SUM'Consumos Onco'[Measure Values] ),
    DATESINPERIODcalendario[Date] , MAXcalendario[Date] ) , -12 , MONTH )
)
 
And I want to crate the cummulate sum of "Participacion Total" this is the expression:
Participacion Total = DIVIDE([MAT],
    CALCULATE (
        SUM ( 'Consumos Onco'[Measure Values] ),
        FILTER ( ALL ( 'Consumos Onco' ), [Measure Names] = "Consumo" ),DATESINPERIODcalendario[Date] , MAXcalendario[Date] ) , -12 , MONTH )
    ))
 
The proble is that I dont know how to calcualte a cummulative sum of a calculated field
 
 
Anonymous
Not applicable

Hi @claudirnava ,

I think you can change your DAX code.

Cumulative Participacion Total = 
CALCULATE(
    SUMX(
        FILTER(
            ALLSELECTED(calendario[Date]),
            calendario[Date] <= MAX(calendario[Date])
        ),
        [Participacion Total]
    )
)

 

 

 

Best Regards

Yilong Zhou

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.