Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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
LivioLanzo
Solution Sage
Solution Sage

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!  

View solution in original post

6 REPLIES 6
LivioLanzo
Solution Sage
Solution Sage

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!  

Anonymous
Not applicable

I think that got it. Thank you!

Omega
Impactful Individual
Impactful Individual

Try: 

 

Measure = calculate (max (value), allexcept (table1, AssetID))
Anonymous
Not applicable

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
Impactful Individual
Impactful Individual

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?

Anonymous
Not applicable

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? 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.