Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Cummulative sum by week for bar graph

Hi guys,

 I need cummulative sum of "Quantity" as per week.

eg week 1

    week2=week2+week3......

so far

Problem here is ,source gives the one amount for whole month,which we have broken down in 30 days.(cummulative will result in final result).But not able to break it week wise to get  weekly cummulative sum.I have alreday tried below DAX function  which does not work.

Cumulative Quantity =
CALCULATE (
    SUM ( (quantity]),
    FILTER (
        ALL ( 'Date'[Date] ),
        'Date'[Date] <= MAX ( 'Date'[Date] )
    )
)

 

 

DatequantityYearMonthYear Month
Tuesday, May 1, 20188302018520185
Friday, June 1, 201812002018620186
Sunday, July 1, 2018252018720187
Wednesday, August 1, 201852018820188
Saturday, September 1, 201838002018920189
Monday, October 1, 2018100201810201810
Thursday, November 1, 20181400201811201811
Saturday, December 1, 20183345201812201812
Saturday, December 1, 201855201812201812

 

structure:

Table 1 joined with DATE table

 

Any suggestion would be appreciated.

 

2 Replies

  • TeigeGao's avatar
    TeigeGao
    Icon for Solution Sage rankSolution Sage

    Hi Anonymous ,

    Could you please share the expected result and the target visual to us? I can't understand your requirement very well. Why will "week2=week2+week3......", besides, your sample data are all the first day of each month rather than a week.

    Generally, when we want to get the cummulative sum of data in a week, for example, monday it will display monday, Tuesday displays the sum of Monday and Tuesday, we will create a week column in the calendar table.

    Best Regards,

    Teige

    • Anonymous's avatar
      Anonymous
      Not applicable

       

       

       

       

       

       

       

       

      Basically we get data for first day of the month which is  eg.14000000,which we break into month days to display the line graph.

      Now problem here is we have to break the amount week wise to display it as cummulative sum.@cha