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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tiff
Helper I
Helper I

Calculate a cumulative year to year

Hello everyone 🙂 

 

I have a Table called 'ESSAIS' with various columns. 

One of them is the quantity month by month. I have a column for cumulative quantity. 

I did like this to have my cumulative column : 

Cumule = CALCULATE(SUM(ESSAIS[QtyMonth]);ALL(ESSAIS);ESSAIS[Date]<=EARLIER(ESSAIS[Date])) 

 

I've data on four years, and I'd like to reset my cumulative column on each january... 

Is it possible on Power BI ? I haven't found it on the web... Really disturbing ! 

 

I tried, with a new column, to test the month. And the month of January, put 0 in the cumulative Column. It's okay, but doesn't reset the SUM... And the month on February is added to the precedent sum... 

 

 

Thank you very much for your help ! 

 

1 ACCEPTED SOLUTION
Tiff
Helper I
Helper I

Found what I wanted ! 

If it can help any of you, the formula : 

 

ECC REMISZERO = VAR myDate = ESSAIS[Date]
RETURN
CALCULATE(
SUM(ESSAIS[QtyMois]);
FILTER(
ESSAIS;
ESSAIS[Date]<=myDate
&& YEAR(ESSAIS[Date])=YEAR(myDate)))

It resets the sum every January ! 😄

View solution in original post

4 REPLIES 4
Tiff
Helper I
Helper I

Found what I wanted ! 

If it can help any of you, the formula : 

 

ECC REMISZERO = VAR myDate = ESSAIS[Date]
RETURN
CALCULATE(
SUM(ESSAIS[QtyMois]);
FILTER(
ESSAIS;
ESSAIS[Date]<=myDate
&& YEAR(ESSAIS[Date])=YEAR(myDate)))

It resets the sum every January ! 😄

Hi @Tiff 

 

Do you know how to use this in measure?

v-yulgu-msft
Employee
Employee

Hi @Tiff,

 

You may need this formula:

Cumule =
CALCULATE (
    SUM ( ESSAIS[QtyMonth] );
    FILTER (
        ALLEXCEPT ( ESSAIS; ESSAIS[Date].YEAR );
        ESSAIS[Date] <= EARLIER ( ESSAIS[Date] )
    )
)


Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yuliana, 

 

Thank you for your answer ! 

However, it doesn't reset every January... It is a cumulative sum... On my whole data. 
Do you know how to reset this SUM every January ? (I have data every day between the first of January 2018 and the first of January 2021. 

I would like my SUM to be at zero every month of January.... 

 

I admit I'm totally lost on this one... 😮 

 

Thanks for your help ! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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