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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

running total per year

Hello Community,

 

I would appreciated your help withe the below.

 

I want to

  • find the running total value
  • create a graph its progress through all years

Especially when it comes to the graph, I want to be able to filter it by year or number of years, without impacting the running total calculation.

 

My source table is

ProjectYearValue
PR12020100
PR12021200

PR2

201950
PR2202075
PR22021100
PR3202195
PR32022105
PR32023120
PR42023100
 
 
 

I want to create this table.

YearAggregated Value
201950
2022225
2021620
2022725
2023945

 

Kind regards,

 

George

2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

Hi @Anonymous 

Best to use a date table instead. Try this:

Measure =
VAR maxYear_ =
    MAX ( Table1[Year] )
RETURN
    CALCULATE ( SUM ( Table1[Value] ), Table1[Year] <= maxYear_ )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

amitchandak
Super User
Super User

@Anonymous , Try a measure like

measure = calculate(sum(Table[Value]), filter(allselected(Table), Table[Year] <=max(Table[Year])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

8 REPLIES 8
AlB
Community Champion
Community Champion

@Anonymous 

In maxYear_ you get the current year in the filter context, the one in the current row of your visual. 

The Table1[Year] <= maxYear_ part then tells the CALCULATE to compute  SUM ( Table1[Value] ) over all the years that are equal or smaller than the current year.

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

Anonymous
Not applicable

thank you @AlB , for me is always very helpful to also know the logic behind the solution, kind regards.

AlB
Community Champion
Community Champion

@Anonymous 

the solution above does not use a date table

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

amitchandak
Super User
Super User

@Anonymous , Try a measure like

measure = calculate(sum(Table[Value]), filter(allselected(Table), Table[Year] <=max(Table[Year])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you @amitchandak 

 

Your proposal worked just fine.

 

May I only ask to elaborate more on the logic behind your solution? 

 

I also follow your LinkedIn posts , extremely helpful !

 

Thank you

 

George

AlB
Community Champion
Community Champion

Hi @Anonymous 

Best to use a date table instead. Try this:

Measure =
VAR maxYear_ =
    MAX ( Table1[Year] )
RETURN
    CALCULATE ( SUM ( Table1[Value] ), Table1[Year] <= maxYear_ )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Anonymous
Not applicable

Thank you @AlB 

 

Your proposal worked out perfectly.

 

Can I only ask how the variable maxYear interacts with CALCULATE in order to produce the correct result?

 

Thank you,

 

George

Anonymous
Not applicable

Hello @AlB , is there a way to resolve this without using a date table? Thank you

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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