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

Cumulative SUM by CODE

Hi Everyone,

 

How can I create a "Coste Actual Estimado" column that shows an accumulated value, something like this:

 

 Coste Mensual EstimadoCoste Total 2015Coste Actual Estimado
Month05050
January05050
February05050
March05050
April05050
May05050
June05050
July155065
August105075
September155090
October 05090
November 3550125
December4050165

 

In addition, I have to disinguish the values by CODE (cause I have a lot of projects).

 

Thanks

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @as3znaus,

 

Based on the sample data above, you can create "Coste Actual Estimado" column using below formula. But, you should add an index column in Query Editor.

 

Coste Actual Estimado =
CALCULATE (
    SUM ( 'Cumulative SUM'[Coste Mensual Estimado] ),
    FILTER (
        'Cumulative SUM',
        'Cumulative SUM'[Index] <= EARLIER ( 'Cumulative SUM'[Index] )
    )
)
    + 'Cumulative SUM'[Coste Total 2015]

1.PNG

 

What do you mean "disinguish the values by CODE"? Is "CODE" a column in your source table? For further analysis, would you please share some more sample data and describe more detailed about "CODE"?

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

4 REPLIES 4
Baskar
Resident Rockstar
Resident Rockstar

1. Create one index column for this in Query editor with what sorting u want.

 

2. Create column 

 

Column = var index_1 = index

var sum_of_Coste_Mensual_Estimado = calculate ( sum(Coste Mensual Estimado), filter (all(Table_Name), index < index_1 )

var Val_Coste_Total_2015 = 'Coste Total 2015'

 

 

return Val_Coste_Total_2015 + sum_of_Coste_Mensual_Estimado

 

 

Try this , I hope it will help u dude, 

 

let me know if it is not helping u

Thanks for the answers! I finally managed to avoid this sum using Group By.

 

 

I srtongly recomemded to everyone to avoid Earlier because it will create performance issue.

 

check with large amount of data.

 

v-yulgu-msft
Employee
Employee

Hi @as3znaus,

 

Based on the sample data above, you can create "Coste Actual Estimado" column using below formula. But, you should add an index column in Query Editor.

 

Coste Actual Estimado =
CALCULATE (
    SUM ( 'Cumulative SUM'[Coste Mensual Estimado] ),
    FILTER (
        'Cumulative SUM',
        'Cumulative SUM'[Index] <= EARLIER ( 'Cumulative SUM'[Index] )
    )
)
    + 'Cumulative SUM'[Coste Total 2015]

1.PNG

 

What do you mean "disinguish the values by CODE"? Is "CODE" a column in your source table? For further analysis, would you please share some more sample data and describe more detailed about "CODE"?

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.