Forum Discussion

dvhez's avatar
dvhez
Helper II
7 years ago

Running total values by year

I have various power plants with total capacity and date they got into operation. My objective is to have the total capacity YTD of all power plants. I tried the following DAX code but the custom column I created is just a copy of Table1[Values]. What I'm missing?

 

YTD = 
    CALCULATE (
        SUM (Table1[Values]);
        FILTER(ALLSELECTED(
            Table1;
            Table1[Years] <= MAX(Table1[Years])
        )
    )

 

2 Replies

  • dvhez there are many posts for YTD, first and foremost, it is best practice to have calendar dimension in your model for any time intelligence calculation, do you have one? If no please add one and then you can use TOTALYTD dax function to calculate YTD .

  • Anonymous's avatar
    Anonymous
    Not applicable

    dvhez,

    Create a measure instead of a column to calculate YTD, you can check more details in attached PBIX file. If you don't get expected result, please share sample data of your table here and post desired result.


    Regards,
    Lydia