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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
sundayDriver
Employee
Employee

running sum of cumulative sum

Date

Savings

July 3, 2020

1

July 10, 2020

2

August 2, 2020

1

August 9, 2020

3

September 1, 2020

2

October 3, 2020

4

October 4, 2020

1

November 1, 2020

2

December 4, 2020

2

January 1, 2021

3

January 5, 2021

1

MonthlyTotal = TOTALYTD(SUM([Savings]), [Date], ALL([Date]), "6/30")

Here’s the output I need to get:

 

Year

Month

Savings

MonthlyTotal

YearlyRunningTotal

2020

July

3

3

3

2020

August

4

7

10

2020

September

2

9

19

2020

October

5

14

33

2020

November

2

16

49

2020

December

2

18

67

2021

January

4

22

89

 

What I need help with is the calculation for YearlyRunningTotal.

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @sundayDriver ,

 

1.Create a Index column

Index = YEAR([Date])*100+[Date].[MonthNo]

3.png 

 

2.Create measures

MonthlyTotal = 
CALCULATE (
    SUM ( 'Table'[Savings] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
)
YearlyRunningTotal = 
CALCULATE (
    SUMX (
        SUMMARIZE (
            'Table',
            'Table'[Index],
            "M",
                CALCULATE (
                    SUM ( 'Table'[Savings] ),
                    FILTER ( ALL ( 'Table' ), 'Table'[Index] <= MAX ( 'Table'[Index] ) )
                )
        ),
        [M]
    ),
    FILTER ( ALL ( 'Table' ), [Index] <= MAX ( 'Table'[Index] ) )
)

4.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @sundayDriver ,

 

1.Create a Index column

Index = YEAR([Date])*100+[Date].[MonthNo]

3.png 

 

2.Create measures

MonthlyTotal = 
CALCULATE (
    SUM ( 'Table'[Savings] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
)
YearlyRunningTotal = 
CALCULATE (
    SUMX (
        SUMMARIZE (
            'Table',
            'Table'[Index],
            "M",
                CALCULATE (
                    SUM ( 'Table'[Savings] ),
                    FILTER ( ALL ( 'Table' ), 'Table'[Index] <= MAX ( 'Table'[Index] ) )
                )
        ),
        [M]
    ),
    FILTER ( ALL ( 'Table' ), [Index] <= MAX ( 'Table'[Index] ) )
)

4.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

 

Mikelytics
Resident Rockstar
Resident Rockstar

Dear @sundayDriver 

For running total of a year this should do it:

running total = TOTALYTD(Sum(t_7[Sales]),'Date'[Date],ALL('Date'[Date]),"12/31")
Picture 1.PNG
you can also change the end of year (last ttribute) to "06/30". if it does not work for you please try it in kombination with a date table.
 picture 2.PNG

Best regards

Mikelytics

 

Did I solve your request? Please mark my post as solution.

 

Appreciate your Kudos.

 
------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.