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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Jcho10
Frequent Visitor

Cumulative Sum

Hi everybody,

 

I'm learning PBI and I would like to create a matrix table to calculate :

-In a first column : the total turnover by month

-In a second column : the cumulative turnover

 

I would like to get this result :

 

MONTHTURNOVERCUMULATIVE TURNOVER
184 69384 693
2190 685275 378
360 935336 313
4119 286455 599
544 570500 169
647 644547 813
7130 880678 693
859 472738 165
948 321786 486
1052 564839 050
1116 312855 362
1257 059912 421

 

 

I've created a measure TURNOVER which works well :

 

TURNOVER = 
VAR
DebutCA = SUMMARIZE('Parametres comptes';'Parametres comptes'[DebutCA])
VAR
FinCA = SUMMARIZE('Parametres comptes';'Parametres comptes'[FinCA])
VAR
JournalVentes = SUMMARIZE('Parametres journaux';'Parametres journaux'[JournalVentes])
RETURN
CALCULATE(sum('Journaux 3 ans'[Solde]);
'Journaux 3 ans'[Compte]>=DebutCA;
'Journaux 3 ans'[Compte]<=FinCA;
'Journaux 3 ans'[Journal]=JournalVentes;
)

 

I would like to create a measure to calculate cumulative turnover.

I don't know how to proceed.

 

I tried differents measures but it doesn't works...

 

Thank you for your help.

 

Sincerely

1 ACCEPTED SOLUTION
v-haibl-msft
Microsoft Employee
Microsoft Employee

@Jcho10

 

In this scenario, you need to create a Calendar table first with following formula. And create relationship between the Calendar table with the fact table with Date key.

Calendar = 
CALENDAR ( "1/1/2015", "12/31/2016" )

Cumulative Sum_1.jpg

 

Since I don’t know your table structure, I just create a simple fact table as below. The Measure expression for TURNOVER is “TURNOVER = SUM( Table1[Sold] )”.

Cumulative Sum_2.jpgCumulative Sum_3.jpg

 

Then we can create a Measure with following formula to get the cumulative turnover.

CUMULATIVE TURNOVER = 
CALCULATE (
    [TURNOVER],
    FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
)

Cumulative Sum_4.jpg

 

You can take a look at this document to understand more about Cumulative Sum.

I've also uploaded my .pbix file here for reference.

 

Best Regards,

Herbert

View solution in original post

2 REPLIES 2
v-haibl-msft
Microsoft Employee
Microsoft Employee

@Jcho10

 

In this scenario, you need to create a Calendar table first with following formula. And create relationship between the Calendar table with the fact table with Date key.

Calendar = 
CALENDAR ( "1/1/2015", "12/31/2016" )

Cumulative Sum_1.jpg

 

Since I don’t know your table structure, I just create a simple fact table as below. The Measure expression for TURNOVER is “TURNOVER = SUM( Table1[Sold] )”.

Cumulative Sum_2.jpgCumulative Sum_3.jpg

 

Then we can create a Measure with following formula to get the cumulative turnover.

CUMULATIVE TURNOVER = 
CALCULATE (
    [TURNOVER],
    FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
)

Cumulative Sum_4.jpg

 

You can take a look at this document to understand more about Cumulative Sum.

I've also uploaded my .pbix file here for reference.

 

Best Regards,

Herbert

Hi Herbert Liu,

 

Thank you, it works better with a calendar table !!

 

I have a second question.

I would like to create 2 tables to compare turnover by month in differents years.

 

I've created in my calendar date a column with Text Month Name and this measure :

Turnover by month "TURNOVER = SUM( Table1[Sold] "

 

This table works well

 

But I don't know how to create the 2nde table to have "Turnover cumulate by month"

 

Capture.GIF 

 

 

Because running total with text month doesn't works...

 

 

 

Do you have an idea ?

 

Thank very much for helping me

 

Sincerely

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.