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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LocationUnknown
Frequent Visitor

Calculating percentiles of a measure

Hi all,

 

I am currently trying to calculate the quartiles of a measure.

 

Here is how the data is set up;

 

Project ID1Element ID1Value
Project ID1Element ID2Value
Project ID1Element ID3Value
Project ID2Element ID1Value
Project ID2Element ID2Value
Project ID2Element ID3Value

 

From this the value column is then taken to get an adjusted value based on a slicer, this could be A*58 or it could be in the thousands, but this adjustment is applied to all values. Because this needs to update in real time the adjusted values are stored in a measure. Here is the code of that measure:

 

Benchmark Elemental Value = 
SUM(f_ElementalValues[Value]) *
DIVIDE(
    [Selected Location Factor] * [Selected Time Factor],
    10000
)

Selected Location Factor = 
SELECTEDVALUE(d_LocationFactor[Index], AVERAGE(d_LocationFactor[Index]))

Selected Time Factor = 
SELECTEDVALUE(d_DateFactor[Index], 100)

 

f_Elemental Values is a fact table which is connected to a few dimesion tables however I do not think they are relevent to the problem. d_ Location and Date factor are non active relationship tables which are filtered with a slicer to have a single value.

 

I have seen the inbuilt percentile DAX function however this only applies to a column and not a measure. Is there a way someone has found that will calculate the percentile of a measure?

 

Thanks for any recommendations!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @LocationUnknown ,

The issue here is that PERCENTILE.EXC requires a column. So, what you are going to want to do is create a table as part of your measure in which you want to use PERCENTILE.INC. So, use SUMMARIZE or ADDCOLUMN with a VAR statment to create your "temp table" essentially.

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
VAR _ATABLE =
    SUMMARIZE ( 'Table', 'Table'[subject], "VALLUE", [Measure_VALUE] )
RETURN
    PERCENTILEX.INC ( _ATABLE, [VALLUE], .05 )

You could also use Create Table and put your SUMMARIZE or ADDCOLUMN in that and then just reference that table and stuff.

vpollymsft_1-1652333647040.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @LocationUnknown ,

The issue here is that PERCENTILE.EXC requires a column. So, what you are going to want to do is create a table as part of your measure in which you want to use PERCENTILE.INC. So, use SUMMARIZE or ADDCOLUMN with a VAR statment to create your "temp table" essentially.

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
VAR _ATABLE =
    SUMMARIZE ( 'Table', 'Table'[subject], "VALLUE", [Measure_VALUE] )
RETURN
    PERCENTILEX.INC ( _ATABLE, [VALLUE], .05 )

You could also use Create Table and put your SUMMARIZE or ADDCOLUMN in that and then just reference that table and stuff.

vpollymsft_1-1652333647040.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and your desired output.

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Hi @Anonymous, sadly it did not work and I haven't been able to work out why. I have since scrapped that line of analysis. 

 

SpartaBI
Community Champion
Community Champion

@LocationUnknown you have it in the X familty functions:
https://dax.guide/percentilex-inc/
https://dax.guide/percentilex-exc/

Check also the movie tutorials there.


In case it answered your question, please accept it as a solution to help the other members find it more quickly. Appreciate Your Kudos 💪
Showcase Report – Contoso By SpartaBI 
Website Linkedin Facebook 
This is SpartaBI!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.