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
AnanthanR
Helper I
Helper I

Issue In running Total

Hello Everyone,

 

I am using Power bi Table visual. I tried to create running count on my report but, I am not getting correct value. In my table I have Container, Operation and Timestamp and Duration columns. I needs to create the running total for duration by Container and Operation. but some time the running total getting reset for next operation for same container.

 

AnanthanR_0-1719558573643.png

for next operation its resetting the running count. below is my DAX query. I have rework flag slicer so I have added Reworflag in Dax.

 

Running Total Duration =
VAR CurrentDate = MAX('Report'[Time Stamp])
VAR CurrentContainer = MAX('Report'[Container])
VAR CurrentOperation = MAX('Report'[Operation])
VAR CurrentReworkFlag = MAX('Report'[Rework Flag])

RETURN
CALCULATE(
    SUM('Report'[Duration (Minutes)]),
    FILTER(
        ALL('Report'),
        'Report'[Time stamp] <= CurrentDate &&
        'Report'[Container] = CurrentContainer &&       
        'Report'[Rework Flag] = CurrentReworkFlag
    )
)

 

Thanks,

Ananth

7 REPLIES 7
elitesmitpatel
Solution Supplier
Solution Supplier

Please share a demo pbix file, and also your output what you want, Thanks

Hi elismitpatel,

 

please find the attached screenshot for my report. I have to calculate the running total for Duration, for each container. I have marked in yellow its not getting correct running total.

AnanthanR_0-1719813025392.png

 

here is Dax quey I have used for running total.

 

Running Total Duration =
VAR CurrentDate = MAX('Report'[Time Stamp])
VAR CurrentContainer = MAX('Report'[Container])
VAR CurrentOperation = MAX('Report'[Operation])
VAR CurrentReworkFlag = MAX('Report'[Rework Flag])

RETURN
CALCULATE(
SUM('Report'[Duration (Minutes)]),
FILTER(
ALL('Report'),
'Report'[Time stamp] <= CurrentDate &&
'Report'[Container] = CurrentContainer &&
'Report'[operation] <= CurrentOperation &&

'Report'[Rework Flag] = CurrentReworkFlag

))

 

Thanks,

Ananth

 

 

 

Hi Elitesmitpatel,

 

Here I am not able to attach the file. Attachment option not available.

 

Thanks,

Ananth

rajendraongole1
Super User
Super User

Hi @AnanthanR - Can you try the below measure , add one more condition with operation 

Measure:

 

Running Total Duration =
VAR CurrentTimestamp = MAX('Report'[Time Stamp])
VAR CurrentContainer = MAX('Report'[Container])
VAR CurrentOperation = MAX('Report'[Operation])
VAR CurrentReworkFlag = MAX('Report'[Rework Flag])

RETURN
CALCULATE(
SUM('Report'[Duration (Minutes)]),
FILTER(
ALL('Report'),
'Report'[Time Stamp] <= CurrentTimestamp &&
'Report'[Container] = CurrentContainer &&
'Report'[Operation] <= CurrentOperation &&
'Report'[Rework Flag] = CurrentReworkFlag
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thanks Rajendra for your time, I have tired the dax you provided but still i am not getting correct running total. but when i select the values in Rework slicer running count working fine.

 

AnanthanR_0-1719566986483.png

Thanks,

Ananth

Hi @AnanthanR - can you try below one.

Running Total Duration =
VAR CurrentTimestamp = MAX('Report'[Time Stamp])
VAR CurrentContainer = MAX('Report'[Container])
VAR CurrentOperation = MAX('Report'[Operation])
VAR CurrentReworkFlag = MAX('Report'[Rework Flag])

RETURN
CALCULATE(
SUM('Report'[Duration (Minutes)]),
FILTER(
ALL('Report'[Time Stamp], 'Report'[Container], 'Report'[Operation], 'Report'[Rework Flag]),
'Report'[Time Stamp] <= CurrentTimestamp &&
'Report'[Container] = CurrentContainer &&
'Report'[Operation] <= CurrentOperation &&
(ISBLANK(CurrentReworkFlag) || 'Report'[Rework Flag] = CurrentReworkFlag)
)
)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi Rajendra, 

Still its not working could you please help me on this.

 

Thanks,

Ananth

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.