Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Can anyone help with the above error and a workaround?
Justlike average i also need 50th percentile, 75th percentile for creating box plots
so percentile.inc is also not working with this
Solved! Go to Solution.
Hi @klehar ,
The error in your DAX formula occurs because the AVERAGE function only accepts a column reference as an argument, but you are passing an expression (1 - DIVIDE(netprice, listprice)).
Solution:
Instead of using AVERAGE, use the AVERAGEX function, which allows row-wise calculations on a table.
Corrected Code:
DAX
RETURN
IF(
listprice <> 0,
AVERAGEX(
TableName,
1 - DIVIDE(TableName[netprice], TableName[listprice])
),
BLANK()
)
AVERAGEX iterates over the TableName and computes the expression for each row before averaging the results.
TableName should be replaced with your actual table name containing netprice and listprice.
Please mark this post as solution if it helps you. Appreciate Kudos.
Hi @klehar ,
The error in your DAX formula occurs because the AVERAGE function only accepts a column reference as an argument, but you are passing an expression (1 - DIVIDE(netprice, listprice)).
Solution:
Instead of using AVERAGE, use the AVERAGEX function, which allows row-wise calculations on a table.
Corrected Code:
DAX
RETURN
IF(
listprice <> 0,
AVERAGEX(
TableName,
1 - DIVIDE(TableName[netprice], TableName[listprice])
),
BLANK()
)
AVERAGEX iterates over the TableName and computes the expression for each row before averaging the results.
TableName should be replaced with your actual table name containing netprice and listprice.
Please mark this post as solution if it helps you. Appreciate Kudos.
Thanks for the reply
What about percentile.inc?
Hi @klehar ,
Just like AVERAGE, the PERCENTILE.INC function in Power BI also requires a column reference and does not accept row-wise calculations directly.
Use PERCENTILEX.INC Instead
To calculate percentiles based on an expression, use PERCENTILEX.INC, which allows iteration over a table (similar to AVERAGEX).
Corrected Code for 50th & 75th Percentile
DAX
RETURN
IF(
SELECTEDVALUE(TableName[listprice]) <> 0,
PERCENTILEX.INC(
TableName,
1 - DIVIDE(TableName[netprice], TableName[listprice]),
0.50 -- Change to 0.75 for the 75th percentile
),
BLANK()
)
Please mark this post as solution if it helps you. Appreciate Kudos.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
55 | |
38 | |
31 |
User | Count |
---|---|
78 | |
64 | |
64 | |
49 | |
45 |