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
mrenzo01
Frequent Visitor

Running Total w/ Less Than or Equal Condition (not dates)

Hello,

 

I am trying to calculate the running total within a data set of people. Each person has an attribute "Highest Level" that indicates the highest level they achieved across an 11 step process. I am trying to display the running total count of people to reach each level where anyone that reached level 11 should also be counted in all levels that preceded it (10, 9 8, etc). I am trying to accomplish this by using a combination of CALCULATE, COUNTROWS, FILTER, and MAX (as I have seen in other forums) but the result is not accurate. In the provided graphic, the correct result for Level 3 should be 701 (453 +248), What am I doing wrong?

 

The formula I am using is as follows:

 

Reach Level = CALCULATE(
    COUNTROWS(TableName),
    FILTER(
        ALLSELECTED(TableName),
        TableName[Highest Level]<=max([Highest Level])
        )
    )

 

Reach Level = CALCULATE(
COUNTROWS(TableName),
FILTER(
ALLSELECTED(TableName),
TableName[Highest Level]<=max([Highest Level])
)
)

running total fail.PNG

 

I tried using the example found here but needed an ALLSELECTED function to account for other report filters applied: https://community.powerbi.com/t5/Desktop/Running-Count/td-p/216728

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @mrenzo01,

 

Do you want to get the output like below?

 

result.PNG

 

If it is, you could try the formula below.

 

Reach Level =
CALCULATE (
    SUM ( 'Table1'[End at level] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        'Table1'[Highest Level] <= MAX ( [Highest Level] )
    )
)

If not, please share some data sample and your desired output so that we could help further on it?

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That is the right output but, unfortunately, that function will not work because the pivot column "End at Level" is also a measure. The error returned when I try to implement the proposed solution is: "The SUM function only accepts a column reference as the argument number 1".

 

I took your advice and created a dummy data set that recreates my issue, provided in Excel and shared from dropbox (link below). The "Source Data Sample" sheet is a data table with two columns. The first is a unique identifier for all people (the item to be counted) and the second is that unique values to be counted against (levels 2 through 11). This dataset is provided using the same outcomes found in my larger data set so it should return the same output. I also provided a sample of the solution in Excel, which matches your values.

 

Dropbox Link: https://www.dropbox.com/s/ele5n144s4k3kel/Running%20Count%20sample%20data.xlsx?dl=0

 

Forgive me but I am new to the forums and unsure of what the proper etiquette or method to share data is, hence the shared dropbox file. 

 

Thank you @v-piga-msft for your first attempt and any follow-up!

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.