cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aymen_Soussi
Frequent Visitor

Cumulated value Between 2 years.

Hello I'm new to DAX Syntaxe and I want to create a mesure that calculate the cumulative value of the budget for the years 2021 and 2022 . exemple: budget for date 01/01/2021 :200 and budget for 01/01/2022 : 200 ,  the result should be cumulative for 01/01/2021: 200 and for 01/01/2022: 400 . By this formula the result is good for the year 2021 but the cumulative value for 2022 is giving a value more than the expected again as I sad the SUM need to be only between the same dates 01/01/2021 goes with 01/01/2022.

Power bi accumulated budget  issue.png

The current code That I have used is: 

 

Accumulated =
VAR vCurrentYear = YEAR( MAX( Abfrage1[date] ) )
RETURN
    IF(
        vCurrentYear = 2022,
        CALCULATE(
            SUM( Abfrage1[budget] ),
            DATESINPERIOD(
                'Abfrage1'[Date],
                MAX( 'Abfrage1'[Date] ),
                -1,
                YEAR
            )
        ),
        SUM( Abfrage1[budget] )
    )

 

 

 

1 REPLY 1
rfigtree
Resolver III
Resolver III

Sorry if i am mis-understanding. But If you have budgets set for each month of 2021 then your measure for 2022 will be the sum of all the budgets in the range. Not just 200+200. But 200+200+200+200+....

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors