Forum Discussion

ahmoh43's avatar
ahmoh43
New Member
2 years ago
Solved

weekly running total

I want to make weekly trend as monthly trend 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ahmoh43 

    Thanks for the solution MFelix  provided, and i want to offer some information for you to refer to.

    Sample data

     

     

    Create a measure.

     

    MEASURE =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        ALLSELECTED ( 'Table' ),
        'Table'[WeekNo] <= MAX ( 'Table'[WeekNo] )
    )
    

     

    Then put the  the measure to the y-axis.

    Output

     

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

     

6 Replies

  • Hi ahmoh43,

     

    For this you need to create a cummulative measure that will allow to have the calculation for each week.

     

    You can do a measure similar to this one:

    Weekly Cumulative = CALCULATE (SUM(Table[Column]), Table[Week] >= MAX(Table[Week]))

    Be aware that I'm assuming that you are only selecting a specific year for the visualization of the chart.

     

    • SteffanieJ's avatar
      SteffanieJ
      Frequent Visitor

      Hi MFelix - What if I wanted to do something similar comparing 2023-2024 by week but for the last 2 quarteres of the year? Can you add a filter for year as well?

      • MFelix's avatar
        MFelix
        Super User

        Hi SteffanieJ ,

         

        Yes you can do that depending on the result you want to achieve you can add additional filter to the calculation to get the previous year values.

         

        Depending on how you have the setup of your model you can do it using the DATEADD syntax for example or SAMEPERIODLASTYEAR or forcing the year to be equal to MAX(Year) - 1

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ahmoh43 

    Thanks for the solution MFelix  provided, and i want to offer some information for you to refer to.

    Sample data

     

     

    Create a measure.

     

    MEASURE =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        ALLSELECTED ( 'Table' ),
        'Table'[WeekNo] <= MAX ( 'Table'[WeekNo] )
    )
    

     

    Then put the  the measure to the y-axis.

    Output

     

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.