Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Using GROUPBY with PERCENTILEX as expression

Hi guys, 


I have dataset containing three columns
- Department

- Timestamp

- NbrOfCustomers
From this table I would like to compute another table containtng the 90-th percentiles of NbrOfCustomers for each Department. It has to be a proper table as I am to use it in further calcualtions. I have tried the following DAX formula

GROUPBY(MyDataset; MyDataset[Department]; "90th Percentile"; PERCENTILEX.INC(CURRENTGROUP(); MyDataset[NbrOfCustomers]; 0,9))

which works like a charm when using SUMX, AVERAGEX etc as expression. But for some reason it does not work with the PERCENTILEX. I get the following error message

"Function 'GROUPBY' scalar expressions have to be Aggregation functions over CurrentGroup(). The expression of each Aggregation has to be either a constant or directly reference the columns in CurrentGroup()."


Why is this? 



Re: Using GROUPBY with PERCENTILEX as expression

Hi @Majfah,


From this document, we can see that:

"The CURRENTGROUP function takes no arguments and is only supported as the first argument to one of the following aggregation functions: AverageX, CountAX, CountX, GeoMeanX, MaxX, MinX, ProductX, StDevX.S, StDevX.P, SumX, VarX.S, VarX.P." PERCENTILEX is not a supported function to be used inside CURRENTGROUP() function.



Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors