Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Cumulative weeks

Hi everyone,    I just want to figure it out how to cumulate the sum of Turnover by weeks please? In other word, I would like to create this graph :   x = Weeks by one year y = Turnover   But...
  • joaoribeiro's avatar
    2 years ago

    Hi Anonymous ,

     

    For this you can check what are your first and last dates for each data point and then calculate the measure in the 'datesbetween'. Please check an example below that I created based on your scenario:

    Cumulative Value = 
    VAR _min_date = CALCULATE(MIN('Table Name'[Date]), REMOVEFILTERS('Table Name'[Week]))
    VAR _last_date = MAX('Table Name'[Date])
    
    RETURN
    CALCULATE(
        SUM('Table Name'[Value]),
        DATESBETWEEN('Table Name'[Date], _min_date, _last_date),
        REMOVEFILTERS('Table Name'[Week])
    )

     

     

    Hope this answer solves your problem!
    If you need any additional help please @ me in your reply.
    If my reply provided you with a solution, please consider marking it as a solution โœ”๏ธ or giving it a kudoe ๐Ÿ‘

    Thanks!

    Best regards,
    Joao Ribeiro