- Forums
- Get Help with Power BI
- Desktop
- Service
- Report Server
- Integrations with Files and Services
- Mobile Apps
- Developer
- Let's Talk Data
- Custom Visuals Development Discussion
- Community Support
- Welcome to the Community
- Community Feedback
- Community Help Blog
- Training and Consulting
- Dashboard in a Day
- EdX Specific Training Discussion Forum

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Microsoft Power BI Community
- Forums
- Get Help with Power BI
- Desktop
- Dynamically Exclude 10 Percent of an Asset's Highe...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

andrewcolemfd

Frequent Visitor

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
05:51 AM

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

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!

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

LivioLanzo

Super User

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
06:23 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
06:03 AM

Try:

Measure = calculate (max (value), allexcept (table1, AssetID))

andrewcolemfd

Frequent Visitor

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
06:10 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
06:12 AM

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

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

Right?

andrewcolemfd

Frequent Visitor

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
06:22 AM

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?

LivioLanzo

Super User

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
06:23 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2018
06:36 AM

I think that got it. Thank you!