cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jvangrunderbeec Frequent Visitor
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.
running total.PNG

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 ()
)

 

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
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

View solution in original post

1 REPLY 1
Community Support Team
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

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)