Forum Discussion

Etienne123's avatar
Etienne123
Icon for Advocate II rankAdvocate II
8 years ago
Solved

Cumulative Sum, reset by recurring group

I need to calculate the time an animal spends in a sector, and only for the time it resides in that sector - an animal can move in and out of a sector many times. Each "visit" constitutes a new visit...
  • Etienne123's avatar
    Etienne123
    8 years ago

    Issue resolved for anyone interested. The issue was with the formula GroupMinTime. It required a statement to enforce a reset on RodentId.

     

    GroupMinTime =
    CALCULATE(
    MAX(
    'Sample data 1'[GroupVar])
    ,FILTER(all('Sample data 1')
    ,'Sample data 1'[Index] <= EARLIER('Sample data 1'[Index])
    && 'Sample data 1'[RodentId] = EARLIER('Sample data 1'[RodentId])
    ))