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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AudreyWen
Helper I
Helper I

Cumulative ascending repeat with change in column

Hi,

 

I don't know how to create an formula in PowerBI that makes ascending cumulatives that repeats with every change in column "Name".

Example: (Als = IF function)

Example1.PNG

 

In this example is the calculated column "cumulative visitors".

This shows that "Ans" had 7 visitors in total on 5-9-2019 (4+3). The cumulative numbers has to start with every change in name.

 

I have tried;

Example3.PNG

But this gives only the total cumulative number for a name. The same result as for column "SomAls" with calculation:

SomAls = CALCULATE(SUM(Blad1[Aantal bezoekers]);ALLEXCEPT(BLAD1;Blad1[Naam])).

So this doesn't give the right numbers that i want. 

 

I have no idea how i can create the same calculated column in PowerBI.

 

I hope someone knows how i can do this.

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

Calcum = CALCULATE(SUM('Table'[Total Visitors]),ALLEXCEPT('Table','Table'[Name],'Table'[Date],'Table'[Index]),FILTER('Table','Table'[Name]<=EARLIER('Table'[Name]) && 'Table'[Date]<=EARLIER('Table'[Date]) && 'Table'[Index]=EARLIER('Table'[Index])))
DD.JPG
 
 
 
 
 
 
 
 
 
 
Hope this helps.

Regards,
Sandeep M

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Use the below Formula.

 

CumSum = CALCULATE(SUM('Table'[Total Visitors]),ALLEXCEPT('Table','Table'[Name]),FILTER('Table','Table'[Name]<=EARLIER('Table'[Name]) && 'Table'[Date]<=EARLIER('Table'[Date])))


@Anonymous wrote:

Use the below Formula.

 

CumSum = CALCULATE(SUM('Table'[Total Visitors]),ALLEXCEPT('Table','Table'[Name]),FILTER('Table','Table'[Name]<=EARLIER('Table'[Name]) && 'Table'[Date]<=EARLIER('Table'[Date])))

 

Hi, Thanks for your reply!

 

I have tried the DAX that you have given me but I still get the wrong numbers:

 

Example4.PNG

 

In the first range it starts goed but from "Jan" it goes wrong. The numbers has to be the same as in column "Cumulative visitors".

 

Can you please help me again with this? 🙂 

 


kentyler
Solution Sage
Solution Sage

see my reply below





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Pardon, I think I identified the wrong pattern in my previous post. Here is some sample code from an online article

A similar technique can show running totals over different attributes and dimensions. In the demo database, customers are clustered into different categories, based on purchase volume: Platinum, Gold and Silver. What if the user wants a running total of sales amounts for their top tier customers, starting at the top with the Platinum category? The running total pattern is a useful technique here, too.
The goal is to obtain the following report: :

The DAX code for RT Sales Customer Class uses the very same pattern as for the running total described earlier:

1
2
3
4
5
6
7
8
RT Sales Customer Class :=
VAR CurrentCustomerClass = SELECTEDVALUE ( Customer[Customer Class Number] )
RETURN
    CALCULATE (
        [Sales Amount],
        Customer[Customer Class Number] <= CurrentCustomerClass,
        ALL ( Customer[Customer Class] )
    )

showing how to get a cumulative total for a value that changes (in this case "customer class"). The article provides a lot of examples and may help you see the trick you need to do

https://www.sqlbi.com/articles/computing-running-totals-in-dax/





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Hi, Thanks for you reply!!

 

With this i only get cumulative totals but that is not what i mean. I want a column that shows all the cumulatives per row.

 

I hope you still want to help me with this 🙂

Anonymous
Not applicable

Hi,

 

Calcum = CALCULATE(SUM('Table'[Total Visitors]),ALLEXCEPT('Table','Table'[Name],'Table'[Date],'Table'[Index]),FILTER('Table','Table'[Name]<=EARLIER('Table'[Name]) && 'Table'[Date]<=EARLIER('Table'[Date]) && 'Table'[Index]=EARLIER('Table'[Index])))
DD.JPG
 
 
 
 
 
 
 
 
 
 
Hope this helps.

Regards,
Sandeep M

Many thanks!!! 🙂 this works, i'm very happy!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.