cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
5up Frequent Visitor
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? 

 

ProductTimePerUnit
A10
A15
A20
A25
B500
B550
B570
B590
B650
C33
C35
C36
C45
C50

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
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 )
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

1 REPLY 1
Super User
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 )
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!