Forum Discussion

jsteffe's avatar
jsteffe
Icon for Helper III rankHelper III
4 years ago
Solved

Cumultive data for 3 different years on the same graph

Hello, I get a table with a column Date and a column numberOfParticipants I want to design the graph below : I want to get the cumulative sum of numbers per month for my all 3 years.   Tha...
  • jsteffe's avatar
    jsteffe
    4 years ago

    If I add The Year column in the legend, I get :

    For year 2020, it cumulates the numbers of 2019 and 2020.
    As I don't want to cumulate, amitchandak suggested to create 3 measures :

    YTDnb = CALCULATE(SUM(Stages[nbParticipants]),DATESYTD('Calendar'[Date],"12/31"))
    YTDnb-1 = CALCULATE(SUM(Stages[nbParticipants]),DATESYTD(dateadd('Calendar'[Date],-1,Year),"12/31"))
    YTDnb-2 = CALCULATE(SUM(Stages[nbParticipants]),DATESYTD(dateadd('Calendar'[Date],-2,Year),"12/31"))
     
    and then I get the good result :
     
    Thanks to you rsbin and to amitchandak for your great help ...