Forum Discussion

Levent's avatar
Levent
Frequent Visitor
7 years ago
Solved

Cumulative by week

Hello,

 

Anybody can resolve my problem ? 

 

I want to get the budget of project by week with DAX.  I have startDate and endDate. But i can't calculate realtive to week.. I tried by month with TOTALMTD but it's not good result.

 

Thanks a lot for your responses !

  • Hi Levent ,

     

    One sample for your reference, Please check the following steps as below.

     

    1. Create a Calendar table and insert a calculated column in it.

     

    Calendar = CALENDARAUTO()
    Week = "Week" & WEEKNUM('Calendar'[Date])

    2. Create a measuare to get the excepted result.

     

    Measure = 
    CALCULATE(SUM(Porjects[Budget]),FILTER(Porjects, Porjects[DateEnd]>=MIN('Calendar'[Date])))

     

    Pbix as attached.

     

5 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Community Support

    Hi Levent ,

     

    One sample for your reference, Please check the following steps as below.

     

    1. Create a Calendar table and insert a calculated column in it.

     

    Calendar = CALENDARAUTO()
    Week = "Week" & WEEKNUM('Calendar'[Date])

    2. Create a measuare to get the excepted result.

     

    Measure = 
    CALCULATE(SUM(Porjects[Budget]),FILTER(Porjects, Porjects[DateEnd]>=MIN('Calendar'[Date])))

     

    Pbix as attached.

     

    • Levent's avatar
      Levent
      Frequent Visitor

      Thanks a lot, it's clear and perfect !

  • Try this:

     

    Cumu_Total = Calculate(Sum(Table[Budget]), Filter(All("Table[Date]"), Table[Date] <= MAX (Table[Date])))

    • Levent's avatar
      Levent
      Frequent Visitor

      Thank for your response. 

       

      It's not just cumulating in time week by week.

      But I need to cumulate only the budgets that have a start and end date in the first day of the week.