cancel
Showing results for
Did you mean:
Frequent Visitor

## Removing X% outlier records

Hi, please help me to remove let's say 25% outlier records from both top and bottom within each subset of data. Given example has 3 subsets for three products - A, B and C. Each row shows how much time it took to make one part and then it's sorted by Product and TimePerUnit for display purposes. According to the above 25% outlier rule, I should remove the highlighted records from each subset. Essentially, it's removing 25% of the smallest and highest values within a subset. How can I achieve the same results using DAX?

 Product TimePerUnit A 10 A 15 A 20 A 25 B 500 B 550 B 570 B 590 B 650 C 33 C 35 C 36 C 45 C 50

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Removing X% outlier records

Try:

```Table =
FILTER(
Data,
VAR LowerPerc =
CALCULATE(
PERCENTILEX.INC( Data, Data[TimePerUnit] * 1.0, 0.25 ),
ALLEXCEPT( Data, Data[Product] )
)
VAR UpperPerc =
CALCULATE(
PERCENTILEX.INC( Data, Data[TimePerUnit] * 1.0, 0.75 ),
ALLEXCEPT( Data, Data[Product] )
)
RETURN
AND( Data[TimePerUnit] <= UpperPerc, Data[TimePerUnit] >= LowerPerc )
)```

Proud to be a Datanaut!

Super User

## Re: Removing X% outlier records

Try:

```Table =
FILTER(
Data,
VAR LowerPerc =
CALCULATE(
PERCENTILEX.INC( Data, Data[TimePerUnit] * 1.0, 0.25 ),
ALLEXCEPT( Data, Data[Product] )
)
VAR UpperPerc =
CALCULATE(
PERCENTILEX.INC( Data, Data[TimePerUnit] * 1.0, 0.75 ),
ALLEXCEPT( Data, Data[Product] )
)
RETURN
AND( Data[TimePerUnit] <= UpperPerc, Data[TimePerUnit] >= LowerPerc )
)```