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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Trying to create a cumulative total for people onboard a bus between bus stops

Hi!
As the subjectline foretells i am trying to create a culumative total.

DanZloo_0-1671704499352.png


I am trying to create a measure or a calculated column that takes totalInBalance and totalOutBalance into consideration.
So the new measure/column to the far right of the table should be:
12 on row 1,
11 on row 2,
9 on row 3
and so on

Any help would be much obliged!

Kind Regards
/D

1 ACCEPTED SOLUTION
HiraNegi
Resolver II
Resolver II

Hi,

You can create measures/columns to calculate the running sum of InBalance and OutBalance and subtract to get the final result.

 

Here is the final screenshot with sample data.

HiraNegi_0-1672219930645.png

Below measures were created.

Note: you can incorporate all measures into one as well.

 

InBlanace(RTotal) = CALCULATE(sum('Table (2)'[InBalance]), 'Table (2)'[Position] <= MAX('Table (2)'[Position]))
 
OutBlanace(RTotal) = CALCULATE(sum('Table (2)'[OutBalance]), 'Table (2)'[Position] <= MAX('Table (2)'[Position]))
 
RTotal_Difference = [InBlanace(RTotal)] - [OutBlanace(RTotal)]
 
Hope this helps.
 

View solution in original post

4 REPLIES 4
HiraNegi
Resolver II
Resolver II

Hi,

You can create measures/columns to calculate the running sum of InBalance and OutBalance and subtract to get the final result.

 

Here is the final screenshot with sample data.

HiraNegi_0-1672219930645.png

Below measures were created.

Note: you can incorporate all measures into one as well.

 

InBlanace(RTotal) = CALCULATE(sum('Table (2)'[InBalance]), 'Table (2)'[Position] <= MAX('Table (2)'[Position]))
 
OutBlanace(RTotal) = CALCULATE(sum('Table (2)'[OutBalance]), 'Table (2)'[Position] <= MAX('Table (2)'[Position]))
 
RTotal_Difference = [InBlanace(RTotal)] - [OutBlanace(RTotal)]
 
Hope this helps.
 
Anonymous
Not applicable

Hi PBI Community!

 

Still need help with this. This is not resolved. 

 

Any help would be much obliged!

 

Mvh

Anonymous
Not applicable

Hi @Idrissshatila Thank you. I have tried but i think that i need som help with the syntax.

BR
/D

Idrissshatila
Super User
Super User

Hello,

 

This article will help you solve your problem.

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

 

If I answered your question, please mark my post as solution so it would appeare to others, Appreciate your Kudos 👍

 

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.