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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
steamexpert
Regular Visitor

Trying to calculate a running total column

Hi, 

 

I'm trying to calculate the running total for a table that has two columns Capacity input and Dummy Capacity. The total for the row should be Capacity input - dummy capacity. Example: line 1 in the table below should be 13 - 21 = -8.

 

Capacity input is the count of line items for each bin and Dummy Capacity is the average capacity per bin (this number can be hardcoded if it's going to make the calculation easier).

 

I looked around for a few ideas on how to write a DAX that could work, but I haven't been successful so far (you can see the output in the table below).

 

Here is the DAX: 

 
Running total = calculate(
sumx(
Project,
sum(Project[Capacity input])-AVERAGE(Project[Dummy Capacity])
),
filter(
ALLSELECTED(Project),
Project[End_Date__c]<=MAX(Project[End_Date__c])
)
)

 

The table below should give me:

 

Row 1 = 13 - 21 = -8

Row 2 = -8 +32 - 21 = +19

Row 3 = 19 + 32 -21 = +30

 

steamexpert_1-1621380339796.png

 

Thanks in advance for any help that you can provide.

 

Best,

Jose

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@steamexpert , Try with these changes

 


Running total = calculate(
sumx(
values(Project[End_Date__c bins]),
calculate(um(Project[Capacity input])-AVERAGE(Project[Dummy Capacity]))
),
filter(
ALLSELECTED(Project),
Project[End_Date__c]<=MAX(Project[End_Date__c])
)
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@steamexpert , Try with these changes

 


Running total = calculate(
sumx(
values(Project[End_Date__c bins]),
calculate(um(Project[Capacity input])-AVERAGE(Project[Dummy Capacity]))
),
filter(
ALLSELECTED(Project),
Project[End_Date__c]<=MAX(Project[End_Date__c])
)
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

This worked like a charm, thank you @amitchandak 

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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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