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
ewuchatka
Helper II
Helper II

Cumulative

Hello

 

I imagine there will be a table (or chart) presenting Sales by period (as cumulative sum). 

 

I'd like to calculate a cumulative for all people, but also when you select a person from the slicer the cumulative will be just for this person.

 

There are 15 periods in total and below is just some dummy data for three periods.

 

As you've seen, some people have multiple rows with figures.

 

I dont know where to start and will be grateful for your help 🙂

 

Ewa

 

 

Period   Person  Sales

1            Jane     10

1            Jane     11

1            John     13     

1            Tom      5

1            Tom      19

2            Jane      18

2            John      5

2            Tom       20

2            Tom      3

2            Jane      1

3            John      5

3            Jane       11

3            Tom       7

3            Jane       6

3            Tom       11

1 ACCEPTED SOLUTION

Ah, check out the pattern here:

 

http://www.daxpatterns.com/cumulative-total/

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

Create a measure that is basically:

 

Measure = SUM([Sales])

Measures are context aware, meaning that if you display this measure in the context of "all" you will get the total of everyone but if you select a person from a slicer you would get just that one person. Note that you should be able to use the default "sum" aggregation and really not have to create the measure at all for something as simple of a calculation as this.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler

 

Thank you

 

What about Running Totals?

 

Sorry, I might have not been clear, but I am looking into running totals, I thought Running Totals are the same as Cumulative, but I realise that Cumulative 🙂

 

So Period 1 will show Period 1 totals, Period 2 will show Period 1 plus Period 2, Period 3 will show Period 1+2+3.

 

Thanks

 

Ewa

Some aspects of your post are unclear.  But for a running sum you will definitely need an Index column.  You add that via the Query Editor where there is an Add Column tab.

 

There could be an overall running sum - or - a running sum by Period which would reset at the start of a new period.  But then you are asking for i.e. Period 3 to include Period 1 & 2 totals - so that isn't clear as to which you actually seek.

 

Another approach is your Period in Visuals you can set them up to be a hierarchy and you might experiment with that without any custom DAX needed. 

www.CahabaData.com

Ah, check out the pattern here:

 

http://www.daxpatterns.com/cumulative-total/

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.