Forum Discussion

johnbasha33's avatar
johnbasha33
Icon for Super User rankSuper User
2 years ago
Solved

Running total for multiple filters

Hi,   I am running out of ideas here, can you please help me with the below. if you notice below i want to show the running total for no cases opened based on inception date for each year. but he...
  • talespin's avatar
    talespin
    2 years ago

    hi johnbasha33 

     

    My Apology, but I am not sure if I have understood your requirement correctly.

    You want running total(Count) until you see a case closure(Created year = closed year), if that happens you want to reset running total(Count)?

     

    Below Calculated Column will return count based on what I have stated above.

     

    Active Count =
    VAR _CreatedDate = 'Actual Data'[Created Date]
    VAR _MaxClosedDate = CALCULATE( MAX('Actual Data'[Created Date]), REMOVEFILTERS(), YEAR('Actual Data'[Created Date]) = YEAR('Actual Data'[Closed Date]) && 'Actual Data'[Created Date] <= _CreatedDate)
    VAR _MinClosedDate = CALCULATE( MIN('Actual Data'[Created Date]), REMOVEFILTERS())
    VAR _ClosedDate = IF( ISBLANK(_MaxClosedDate), _MinClosedDate, _MaxClosedDate)
    RETURN CALCULATE( COUNT('Actual Data'[CaseID]), REMOVEFILTERS(), 'Actual Data'[Created Date] >= _MaxClosedDate && 'Actual Data'[Created Date] <= _CreatedDate)
    -----------------------------------------------------------------------------------------------------
    If you want it as a measure.
     
    Actice Count New =
    VAR _CreatedDate = SELECTEDVALUE('Actual Data'[Created Date])
    VAR _MaxClosedDate = CALCULATE( MAX('Actual Data'[Created Date]), REMOVEFILTERS(), YEAR('Actual Data'[Created Date]) = YEAR('Actual Data'[Closed Date]) && 'Actual Data'[Created Date] <= _CreatedDate)
    VAR _MinClosedDate = CALCULATE( MIN('Actual Data'[Created Date]), REMOVEFILTERS())
    VAR _ClosedDate = IF( ISBLANK(_MaxClosedDate), _MinClosedDate, _MaxClosedDate)
    RETURN CALCULATE( COUNT('Actual Data'[CaseID]), REMOVEFILTERS(), 'Actual Data'[Created Date] >= _MaxClosedDate && 'Actual Data'[Created Date] <= _CreatedDate)