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
Bokazoit
Post Patron
Post Patron

How to create YTD Cumulative measure/running total?

Above

Data.jpg

 

Above is a screendump of the data in my table. I am trying to create an running total or Cumulative Sum. For each chart I will pick one or more from the [OkoType] and in the chart show month ([Md]) on x-axis and [Amount] on y-Axis and as Legend I use the [Version] coloumn.

 

No matter how I slice it will only give me the amount for each month and not the running total/Cumulative. I have tried something like this:

 

Cumulative Quantity = 
CALCULATE (
    SUM ( AgressoAcc[Total] );
    FILTER (
        ALL ( AgressoAcc[Md] );
        AgressoAcc[Md] <= MAX ( AgressoAcc[Md] )
    )
)

But no matter it helps. What am I doing wrong?

 

1 ACCEPTED SOLUTION
CheenuSing
Community Champion
Community Champion

@Bokazoit

 

Try this

 

1. Firstly create a calendar table in the model and coonect the datekey of calendar table and datekey of transaction table.

   Follow thos link to create a calendar table.

   http://community.powerbi.com/t5/Desktop/How-do-i-create-a-date-table/m-p/23896/highlight/true#M7605

 

2. Create a column Year in the calendar table as Year = Year(Calendar[Date])

3. Now create the measure as

Cumulativ = CALCULATE (
                       sum(AgreesoAcc[Total]),
                                              FILTER (
                                                      ALL ( 'Calendar' ),
                                                      'Calendar'[Year] = MAX ( 'Calendar'[Year] ) &&
                                                             'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
                                       )

                                   )

 

If this works please accpet this as solution and also give KUDOS.

 

CheenuSIng

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
CheenuSing
Community Champion
Community Champion

@Bokazoit

 

Try this

 

1. Firstly create a calendar table in the model and coonect the datekey of calendar table and datekey of transaction table.

   Follow thos link to create a calendar table.

   http://community.powerbi.com/t5/Desktop/How-do-i-create-a-date-table/m-p/23896/highlight/true#M7605

 

2. Create a column Year in the calendar table as Year = Year(Calendar[Date])

3. Now create the measure as

Cumulativ = CALCULATE (
                       sum(AgreesoAcc[Total]),
                                              FILTER (
                                                      ALL ( 'Calendar' ),
                                                      'Calendar'[Year] = MAX ( 'Calendar'[Year] ) &&
                                                             'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
                                       )

                                   )

 

If this works please accpet this as solution and also give KUDOS.

 

CheenuSIng

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
blopez11
Resident Rockstar
Resident Rockstar

Change ALL ( AggressoAcc [Md] ) to just ALL ( AggressoAcc )

If I create a matrix with columns as Month and Rows as Version and sum on Amount. Creates a measure with the corrections You suggested I get the same values for sum(Amount) and Cumulative Total. So if january sum(Amount) = 6 and february sum(Amount) = 7 my Cumulative do not give me January 6 and February (6+7) = 13 instead it is 7 ??

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.