Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jsteffe
Helper III
Helper III

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 :

cumulate.png

I want to get the cumulative sum of numbers per month for my all 3 years.

 

Thanks for your help.

1 ACCEPTED SOLUTION

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

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 :
cumulate5.png
 
Thanks to you rsbin and to amitchandak for your great help ...

View solution in original post

4 REPLIES 4
harshnathani
Community Champion
Community Champion

Hi @jsteffe ,

 

You can try

 

Measure = SUMX (
    FILTER (
        ALLSELECTED ( Table1[Date] ),
        Table1[Date] <= MAX ( Table1[Date] )
    ),
    [Total Participant]
)

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Thanks for your reply.
It partially  works because with this measure, I get the following graph and using my segments, I can see the graph for each year.

cumulate2.png

But how can I get the 3 curves on the same graph (one for 2019, one for 2020, one for 2021) ?

@jsteffe,

If you have a Year column, you should be able to drag that field into your Legend well.

 

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

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 :
cumulate5.png
 
Thanks to you rsbin and to amitchandak for your great help ...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.