Forum Discussion

SammyNed's avatar
SammyNed
Icon for Helper I rankHelper I
1 year ago
Solved

dynamic median filter

Good Day   We are struggling to get a dynamic median filter.    Please see some sample data below: The portion on the left in blue is the sample data.   On the right is some calculations we ha...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi SammyNed ,

    I create a table as you mentioned.

    Then I create two calculated columns.

    TimeToNewState = DATEDIFF([Time moved to New State], TODAY(), DAY)
    TimeToContactedState = DATEDIFF([Time moved to New State], [Time moved to Contacted State], DAY)

    Next I think you can create two measures and a calculated column.

    MedianTimeToContacted = MEDIANX(
        FILTER(
            'Table',
            NOT(ISBLANK([TimeToContactedState]))
        ),
        [TimeToContactedState]
    )
    IsOutsideMedian = IF(
        AND(
            [Current State] = "New",
            [TimeToNewState] > [MedianTimeToContacted]
        ),
        1,
        0
    )

    LeadsOutsideMedian = CALCULATE(
        COUNTROWS('Table'),
        FILTER(
            'Table',
            [IsOutsideMedian] = 1
        )
    )

     

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.