cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Running total over years

I have a running total over all the year, but i also need a running total that starts counting every year.

Now as you can see in the picture it starts in 2012 but then continues in 2013 with the data from dec 2012. I need another measure that starts from january every year.

My code so far is:
Cumulative Sales (over years)=
IF (
COUNTROWS ( Fact_Transactielijnen ) > 0;
CALCULATE(
[Bedrag];
FILTER(
ALL (Dim_Date[Date]);
Dim_Date[Date] <= MAX ((Dim_Date[Date]))
)
);
BLANK ()
)

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: Running total over years

Hi @jvangrunderbeec,

You can add condition to check current year to break cumulative calculate across different years:

```Cumulative Sales (over years) =
VAR CurrDate =
MAX ( Dim_Date[Date] )
RETURN
IF (
COUNTROWS ( Fact_Transactielijnen ) > 0;
CALCULATE (
[Bedrag];
FILTER (
ALLSELECTED ( Dim_Date );
Dim_Date[Date] <= CurrDate
&& YEAR ( Dim_Date[Date] ) = YEAR ( CurrDate )
)
);
BLANK ()
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Community Support Team

## Re: Running total over years

Hi @jvangrunderbeec,

You can add condition to check current year to break cumulative calculate across different years:

```Cumulative Sales (over years) =
VAR CurrDate =
MAX ( Dim_Date[Date] )
RETURN
IF (
COUNTROWS ( Fact_Transactielijnen ) > 0;
CALCULATE (
[Bedrag];
FILTER (
ALLSELECTED ( Dim_Date );
Dim_Date[Date] <= CurrDate
&& YEAR ( Dim_Date[Date] ) = YEAR ( CurrDate )
)
);
BLANK ()
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

Announcements