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
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
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.

Top Solution Authors