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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Running total

Hi All,

 

I want to create a running total (Not YTD) based on previous 12 months. eg; in May 2017 result should be the count of data points from April 2016 and April 2017 count of data points from March 2016.

 

I used following formula, which doesn't sum up the 12 months data.

RN = CALCULATE(COUNT(DATA[Risk Number]),DATESINPERIOD(DATA[Date Occurred],Lastdate(DATA[Date Occurred]),-12,MONTH))

                             

                                    

Appreciate if anyone has a solution for it. 

1 ACCEPTED SOLUTION

@Anonymous

 

Please create a relationship between the Calendar and LTI table. Then use YearMonth in the X-Axis of the Line chart as below.

 

Running total_2.jpg

 

Best Regards,
Herbert

View solution in original post

6 REPLIES 6
v-haibl-msft
Microsoft Employee
Microsoft Employee

@Anonymous

 

Does above solution work on you side?

 

Best Regards,
Herbert

Anonymous
Not applicable

Hi Herbert @v-haibl-msft,

 

Unfortunately, it doesn't work. It only returns the total of the month not the aggregate value of last 12 months.

@Anonymous

 

That's strange. It works in my attached .pbix file. Could you please share your .pbix file through online file service like OneDrive? So that I can look into it.

 

Best Regards,
Herbert

Anonymous
Not applicable

Hi Herbert @v-haibl-msft

 

Check the link below ;

 

https://drive.google.com/open?id=0B-NaZUyqRQMoNTlBQ3BQOUU4dzQ

 

Regards,

 

Thilan

 

@Anonymous

 

Please create a relationship between the Calendar and LTI table. Then use YearMonth in the X-Axis of the Line chart as below.

 

Running total_2.jpg

 

Best Regards,
Herbert

v-haibl-msft
Microsoft Employee
Microsoft Employee

@Anonymous

 

Please try with following two measures.

 

Total_1 = 
IF (
    ISBLANK ( SUM ( Table1[Sales] ) ),
    BLANK (),
    CALCULATE (
        SUM( Table1[Sales] ),
        DATESBETWEEN (
            'Calendar'[Date],
            FIRSTDATE ( DATEADD ( 'Calendar'[Date], -11, MONTH ) ),
            LASTDATE ( 'Calendar'[Date] )
        )
    )
)
Total_2 = 
IF (
    ISBLANK ( SUM ( Table1[Sales] ) ),
    BLANK (),
    CALCULATE (
        SUM( Table1[Sales] ),
        DATESBETWEEN (
            'Calendar'[Date],
            FIRSTDATE ( DATEADD ( 'Calendar'[Date], -12, MONTH ) ),
            ENDOFMONTH ( DATEADD ( 'Calendar'[Date], -1, MONTH ) )
        )
    )
)

Running total_1.jpg

 

Best Regards,
Herbert

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors