Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Summary until today

Hi guys,

 

I have simple table with dates and daily budget, see below.

I want to create DAX which will calculate summary of budget column since beginning of currently selected year till today.

Note: I have full calendar with multiple years, here is just a sample data for better understanding

 

DateWeekdayMonthWeek NrBudget
12/01/25SundayJanuary2 €            2,184
13/01/25MondayJanuary3 €            1,638
14/01/25TuesdayJanuary3 €            1,638
15/01/25WednesdayJanuary3 €            1,638
16/01/25ThursdayJanuary3 €            1,638
17/01/25FridayJanuary3 €            2,184
18/01/25SaturdayJanuary3 €            2,184
19/01/25SundayJanuary3 €            2,184
20/01/25MondayJanuary4 €            1,638
21/01/25TuesdayJanuary4 €            1,638
22/01/25WednesdayJanuary4 €            1,638
23/01/25ThursdayJanuary4 €            1,638
24/01/25FridayJanuary4 €            2,184
25/01/25SaturdayJanuary4 €            2,184
26/01/25SundayJanuary4 €            2,184
27/01/25MondayJanuary5 €            1,765
28/01/25TuesdayJanuary5 €            1,765
29/01/25WednesdayJanuary5 €            1,765
30/01/25ThursdayJanuary5 €            1,765
31/01/25FridayJanuary5 €            2,353

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Bibiano_Geraldo thanks, but thats not exactly what I want, since when I put it in the table, it will create calculation per each row (including the dates after today), which I dont want to.

    I want to summary of all the budget since 1.1.2025 until todays date (24.1.2025). Today will be dynamic of course.

     

     

     

    • Bibiano_Geraldo's avatar
      Bibiano_Geraldo
      Super User

      Hi Anonymous ,

      Now i got you, you want a comulative until today, please use the bellow measure to achieve your goal, and let me know if its all ok:

      Cumulative Budget YTD = 
      IF(
          HASONEVALUE('Table'[Date]), 
          IF(
              MAX('Table'[Date]) > TODAY(),
              BLANK(),
              CALCULATE(
                  SUM('Table'[Budget]),
                  DATESYTD('Table'[Date]),
                  'Table'[Date] <= TODAY()
              )
          ),
          CALCULATE(
              SUM('Table'[Budget]),
              DATESYTD('Table'[Date]),
              'Table'[Date] <= TODAY()
          )
      )
      

       

      You output should look like this:

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Bibiano_Geraldo ,

         

        it works only when I filter data by date (days).

        When I filter data by weeks or months, its showing data for whole year instead of data until current week or month

  • Hi Anonymous ,

    You can use DATESYTD function to achieve your goal, please use this measure DAX :

    Cumulative Budget YTD = 
    CALCULATE(
        SUM('Table'[Budget]),
        DATESYTD('Table'[Date])
    )