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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ncf5031
Advocate I
Advocate I

Resetting Running Total Based On It's Own Value

Hello all,

 

I'm needing some help with some seemingly simple DAX that is just stumping me. 

 

What I have now is a measure for the running total of a column that tracks pounds of product. Here is the DAX.

 

Product RT =
CALCULATE(
SUM(Product Table[TotalProduct]),
FILTER(
All(DateTable[REPORTING_DT]),DateTable[REPORTING_DT] <=MAX(DateTable[REPORTING_DT])))
 
The running total works fine, but what I'm needing is a way to reset the value once it reaches 100,000,000. I have seen many examples of doing something similar by referencing dates, but unfortunately I haven't been able to apply that technique to this situation. Any help is much appreciated!
1 ACCEPTED SOLUTION

Hi,

Thank you for your reply.

I can see that you have a Date column. This can be used in the formula, instead of using Index column.

I tried to create another sample pbix file like the attached, and please check.

 

Thanks.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

7 REPLIES 7
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but please check the below picture and the attached pbix file.

I tried to create a sample pbix file, and I hope the below helps.

 

All measures are in the attached pbix file.

 

Picture4.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Would there be a way to do this without an index column? I have entries into the table coming from mulitple job locations and I'm trying to do the product total per job location. I would have mentioned that before but I was unaware that the index would be necessary. 

 

The only way that I can get the running total to accumulate correctly is from the formula that I posted above. When using the formula in your example .pbix it would simply sum the entire column and insert that number into each row.

Hi,

Thank you for your feedback.

Please share your sample pbix file, and then I can try to provide more accurate solution that suits your case.

Thanks.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


For some reason I am unable to attach an example .pbix, so I will try to explain my situation a bit better.

 

So, I have the listed the formula above as the way in which I have calculated a running total. This running total works when I apply a filter for job location. So when I have job location selected as "Location 2" the running total is correct for that location. 

 

Thanks to you, I have also been able to establish a group measure that counts how many times that total has gone past 100,000,000. What I am stuck on is that since I don't have an index column I am unable to use your DAX for the reset cumulative which is as follows:

Reset cumulative: =
VAR _currentgrouping = [Grouping every 100:]
RETURN
SUMX (
FILTER (
ALL ( Data ),
Data[Index] <= MAX ( Data[Index] )
&& [Grouping every 100:] = _currentgrouping
),
Data[Value]
).
 
My data looks as follows in table format:
 
DateTotal ProductProductRTGrouping 100MJob Location
9/25/2020 96246096246016
9/26/2020 3383240434570016
9/27/2020 3371960771766016
9/28/2020 33799001109756016
9/29/2020 38688301496639016
9/30/2020 38592501882564016
10/1/2020 38644602269010016

Hi,

Thank you for your reply.

I can see that you have a Date column. This can be used in the formula, instead of using Index column.

I tried to create another sample pbix file like the attached, and please check.

 

Thanks.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you kindly for your help.

davehus
Memorable Member
Memorable Member

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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