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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Matt22365
Resolver III
Resolver III

Reset aggregation measure at the start of each year

Hi all

I hope you can help

I have a measure to generate a "running total" line chart to show spend over time i.e. when a new spend is made the line chart adds that spend to the previous one so the line goes up.

Running Total Actual =
CALCULATE (
    SUM ( 'Tasks & Baselines'[TaskFixedCost] ),
    USERELATIONSHIP ( TimeSet[TimeByDay], 'Tasks & Baselines'[TaskFinishDate] ),
    FILTER (
        ALL ( TimeSet ),
        'TimeSet'[TimeByDay] <= MAX (TimeSet[TimeByDay])
    )
)

 

This works great when looking at my data as a whole as I get a full trend of my spend

example picture:

Matt22365_0-1670513319018.png

 

However, I would like to advance this further by having the measure reset the aggregation start point at the start of each year to £0 spend. This will give me a line chart which trends spend over multiple years which I can plot against a yearly fluctuating budget

 

So something like this:

Matt22365_1-1670513349109.png

 

How can I adapt my measure to achieve this?

 

Thanks for your help

 

Matt 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Running Total Actual =
VAR MaxDate =
    MAX ( TimeSet[TimeByDay] )
VAR StartOfCurrentYear =
    DATE ( YEAR ( MaxDate ), 1, 1 )
RETURN
    CALCULATE (
        SUM ( 'Tasks & Baselines'[TaskFixedCost] ),
        USERELATIONSHIP ( TimeSet[TimeByDay], 'Tasks & Baselines'[TaskFinishDate] ),
        DATESBETWEEN ( 'TimeSet'[TimeByDay], StartOfCurrentYear, MaxDate )
    )

View solution in original post

2 REPLIES 2
Matt22365
Resolver III
Resolver III

Perfect, thank you very much!!!!

 

Matt 

johnt75
Super User
Super User

Try

Running Total Actual =
VAR MaxDate =
    MAX ( TimeSet[TimeByDay] )
VAR StartOfCurrentYear =
    DATE ( YEAR ( MaxDate ), 1, 1 )
RETURN
    CALCULATE (
        SUM ( 'Tasks & Baselines'[TaskFixedCost] ),
        USERELATIONSHIP ( TimeSet[TimeByDay], 'Tasks & Baselines'[TaskFinishDate] ),
        DATESBETWEEN ( 'TimeSet'[TimeByDay], StartOfCurrentYear, MaxDate )
    )

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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