cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
andrewcolemfd Frequent Visitor
Frequent Visitor

Dynamically Exclude 10 Percent of an Asset's Highest Values

Hi all,

I am attempting to create a dynamic measure that returns an asset’s highest value after 10% of the asset’s highest values are removed.

 

For instance, I have a table like the one below. Asset A1 has 20 rows associated with it, while A2 has 10. I would like my measure to return the 18th value for A1 (188) and the 9th value for A2 (193).

 

             Unordered                                                   Ordered

SampleTable.png 

 

Currently, I am attempting to countrows then, using the TOPN and EXCPET functions, return a temporary table where the MAX value is the number I’m trying to get at. I'm missing something because my measure doesn't return anything. 

 

My current code looks like this:

  

90PercentofTime =

VAR sampleSize = COUNTROWS(SampleData)

VAR tenPercent = .10

RETURN

CALCULATE(

    MAX(SampleData[Value]),

    EXCEPT(

        TOPN(sampleSize*tenPercent, SampleData), SampleData))

 

 

Any help would be greatly appreciated.

 

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Dynamically Exclude 10 Percent of an Asset's Highest Values

Hi @

 

ttry like this:

 

Measure = 
IF(
    HASONEVALUE( SampleData[AssetID] ),
    VAR Top10Perc = PERCENTILE.INC(SampleData[Value], 0.9 )
    RETURN
    CALCULATE(
        MAX( SampleData[Value] ),
        SampleData[Value] < Top10Perc
    )
)

 


 


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


Proud to be a Datanaut!  

6 REPLIES 6
Omega Established Member
Established Member

Re: Dynamically Exclude 10 Percent of an Asset's Highest Values

Try: 

 

Measure = calculate (max (value), allexcept (table1, AssetID))
andrewcolemfd Frequent Visitor
Frequent Visitor

Re: Dynamically Exclude 10 Percent of an Asset's Highest Values

Hi Omega, thanks for the suggestion. I think this is in the right direction, but I still need to know how many of an asset's highest values to exclude to equal 10% of its data (rows). Maybe adding TOPN in before or after MAX?

Omega Established Member
Established Member

Re: Dynamically Exclude 10 Percent of an Asset's Highest Values

If I understood this correctly, basically you are trying to apply the following: 

 

  1. Find the max value at assetID level
  2. How much I need to decrease from this asset to equal 10%

 

Right?

andrewcolemfd Frequent Visitor
Frequent Visitor

Re: Dynamically Exclude 10 Percent of an Asset's Highest Values

That's correct. For instance, in the table above, asset A1 has 20 rows of data associated with it, so 10% of A1's rows would equal 2. Therefore I want to exlude the top 2 highest values from A1's data so that I'm left with 188 as A1's highest value. The same applied to A2, however since there are only 10 rows of data, I would only exlude 1 row. The highest value for A2 would then be 193. Does that make sense? 

Super User
Super User

Re: Dynamically Exclude 10 Percent of an Asset's Highest Values

Hi @

 

ttry like this:

 

Measure = 
IF(
    HASONEVALUE( SampleData[AssetID] ),
    VAR Top10Perc = PERCENTILE.INC(SampleData[Value], 0.9 )
    RETURN
    CALCULATE(
        MAX( SampleData[Value] ),
        SampleData[Value] < Top10Perc
    )
)

 


 


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


Proud to be a Datanaut!  

andrewcolemfd Frequent Visitor
Frequent Visitor

Re: Dynamically Exclude 10 Percent of an Asset's Highest Values

I think that got it. Thank you!