Reply
PomJack
Frequent Visitor

Resetting counter after conditions are met

Hi Power BI community,

 

I am trying to count the number for events that different fixtures have over the life of the fixture as measured by date and number of hits on the fixture. When the fixture is worn out, it is repaired and the number of hits resets. I am currently using this function below to calcaulte the running count for each die. It works until the die hits is reset, and then it does not calculate the count as I would like. 

 

Event Count =
COUNTROWS(
    FILTER('Errors',
    'Errors'[Die] = EARLIER([Die]) &&
    'Errors'[Die Hits] <= EARLIER('Errors'[Die Hits]) &&
    'Errors'[Date] <= EARLIER('Errors'[Date])
    ))

 

EventDieDateDie HitsEvent Count (Current)Event Count (Ideal)
AX8/1/2420511
AX8/2/2430022
AX8/3/2433033
BY8/3/24140011
BY8/4/24145622
AX8/5/2450044
BX8/6/2421021
AX8/6/2424032
AX8/7/2431033

 

My second part to this question, is how would I go about displaying just information from the most recent reset for each fixture in report view. Ultimately, I want to display this information in a graph similar to the one below.

 

PomJack_1-1724763909446.png

 

 

1 REPLY 1
lbendlin
Super User
Super User

First part - DAX does not support conditional accumulations. The only tool I know of that can do that is Power Query's List.Accumulate.

 

Second part is actually easier. You can use a measure to identify the last reset point and then suppress everything before that point.

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)