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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
isamchakur
Frequent Visitor

Subset of Column using Percentile

Hello guys

 

I am trying to make a subset of a particular column of values using a percentile (like extracting the 80% highest values), but the percentile measure I've created doesn't work in the comparison row to row. To be more clear about the procedure I tought:

 

-measure Percentile1 = PERCENTILE.INC(Sheet1[Value_Cost],0.2) 

when I display this measure in a card or in a table along with other values from Sheet 1, the calculation is ok

 

- calculated column DataSet_Filtered1 = if(Sheet1[Value_Cost]>[Percentile1],Sheet1[Value_Cost],null)

I wanted to create a column only with the 80% highest values from the first dataset. The result of the calculation doesn't seem correct.

 

When I try to display only the Percentile1 in a calculated column, I've got the error (Expressions who generate variable types of data cannot be used to define calculated columns), so I couldn't see how the Percentile calculation looks like within the calculated column.

 

Any toughts on how to make it work?

 

Thanks a lot

1 REPLY 1
Anonymous
Not applicable

Here's the calculated column:

 

 

 

DataSet_Filtered1 =
var __percentileAcrossFullSet =
	PERCENTILE.INC(
		Sheet1[Value_Cost],
		0.2
	)
return
	if(
		Sheet1[Value_Cost] > __percentileAcrossFullSet,
		Sheet1[Value_Cost]
	)

 

 

 

Your formula does not work because... you have to learn what context transition is, what row context is and how CALCULATE interacts with the latter.

 

Best
D

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.