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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Calculation of the consecutive cumulative by year

Hello:

I have a table with a monthly data for 2024 and 2025. I need to calculate the accumulated value for the total period 2024-2025,

I'm currently calculating it like this:

NOW EAC = TOTALYTD([EAC],'Calendar'[Date])
which generates a graph of this style, but the line of the ACUM EAC is not continuous, but in 2025 it seems that it starts again and does not give the continuity of the data. The EAC line should end by the end of Dec 2025 in total at 12.6 and is finished at 4.9.

Jprada_0-1716238315511.png

These would be the tabulated data...

Jprada_1-1716238636473.png

8 REPLIES 8
nandic
Memorable Member
Memorable Member

@Syndicate_Admin just add filter for years like this:

Cumulative Quantity = CALCULATE(SUM(Podaci[Quantity]),ALL('Calendar'),Podaci[Year]>=2024 && Podaci[Date]<=MAX(Podaci[Date]))

or

Cumulative Quantity = CALCULATE(SUM(Podaci[Quantity]),ALL('Calendar'),Podaci[Godina] in {2024,2025} && Podaci[Date]<=MAX(Podaci[Date]))

Cheers,
Nemanja Andic
Ashish_Mathur
Super User
Super User

Hi,

Write this measure

Measure = calculate([EAC],datesbetween(calendar[date],minx(all(calendar]),calendar[date]),max(calendar[date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I couldn't create the variable...

Jprada_1-1716305425683.png

Measure = CALCULATE([EAC],DATESBETWEEN('Calendar'[Date],MINX(ALL('Calendar','Calendar'[Date]),MAX('Calendar'[Date]))))
I think it's a mistake but I don't know what it is

Hi,

You are missing the closing bracket of the ALL function.  It should be

Measure = CALCULATE([EAC],DATESBETWEEN('Calendar'[Date],MINX(ALL('Calendar'),'Calendar'[Date]),MAX('Calendar'[Date])))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello:

With the setting you tell me it works fine, the issue is that I need you to take the information from the year 2024 onwards. The EAC variable has data from previous years that I don't require, so I was making this adjustment to the code but it didn't work =(

Medida_acumulada = CALCULATE([EAC],DATESBETWEEN('Calendar'[Date],DATE(2024,01,01),'Calendar'[Date]),max('Calendar'[Date])))
Jprada_0-1716386452984.png

This one should work

Medida_acumulada = CALCULATE([EAC],DATESBETWEEN('Calendar'[Date],DATE(2024,01,01),max('Calendar'[Date])))

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
nandic
Memorable Member
Memorable Member

@Syndicate_Admin try using this formula approach:

Cumulative Quantity = CALCULATE(SUM(Table[Quantity]),ALL('Calendar'),Calendar[Date]<=MAX(Calendar[Date]))

No matter how many years you show on chart, it will make cumulative without these year stops.

nandic_1-1716241204824.png

Cheers,
Nemanja Andic

Hello:

Thanks for the info, this code works but I need to be able to filter the data only for the year 2024 and 2025. The database has information since 2020.

Jprada_0-1716304950630.png

I think that's maybe why totals don't matter

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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