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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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