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.
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.
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!
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!
I think that got it. Thank you!
Try:
Measure = calculate (max (value), allexcept (table1, AssetID))
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?
If I understood this correctly, basically you are trying to apply the following:
Right?
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?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |