Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hello, I encountered an error with DAX measure.
The error is:
A function SELECTEDVALUE has been used in a scalar predicate filter expression. This is not allowed
The measure is:
CALCULATE([product_count],all(DIM_PRODUCT), DIM_PRODUCT[PRODUCT_GROUP] = SELECTEDVALUE(DIM_PRODUCT[PRODUCT_GROUP]) &&
DIM_PRODUCT[PRODUCT_SUPGROUP] = SELECTEDVALUE(DIM_PRODUCT[PRODUCT_SUPGROUP]))
how to fix this error?
Solved! Go to Solution.
Hi @MKPA ,
Thanks for the reply from @Uzi2019 , please allow me to provide another insight:
Problems arise with direct use in Filter expressions because the Filter context therein requires Boolean expressions or Table Filter expressions, rather than using scalar values directly.
You can use variables to store SELECTEDVALUE(DIM_PRODUCT[PRODUCT_GROUP]) and SELECTEDVALUE(DIM_PRODUCT[PRODUCT_SUPGROUP]), and then replace them with your original Measure syntax, for example:
Measure =
VAR _a= SELECTEDVALUE(DIM_PRODUCT[PRODUCT_GROUP])
VAR _b= SELECTEDVALUE(DIM_PRODUCT[PRODUCT_SUPGROUP])
RETURN
CALCULATE(
[product_count],
ALL(DIM_PRODUCT),
DIM_PRODUCT[PRODUCT_GROUP] = _a,
DIM_PRODUCT[PRODUCT_SUPGROUP] = _b
)
If that does not solve your problem, please provide the pbix file to help you further, and remember not to log into your account when uploading the pbix file in Power BI Desktop.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @MKPA ,
Thanks for the reply from @Uzi2019 , please allow me to provide another insight:
Problems arise with direct use in Filter expressions because the Filter context therein requires Boolean expressions or Table Filter expressions, rather than using scalar values directly.
You can use variables to store SELECTEDVALUE(DIM_PRODUCT[PRODUCT_GROUP]) and SELECTEDVALUE(DIM_PRODUCT[PRODUCT_SUPGROUP]), and then replace them with your original Measure syntax, for example:
Measure =
VAR _a= SELECTEDVALUE(DIM_PRODUCT[PRODUCT_GROUP])
VAR _b= SELECTEDVALUE(DIM_PRODUCT[PRODUCT_SUPGROUP])
RETURN
CALCULATE(
[product_count],
ALL(DIM_PRODUCT),
DIM_PRODUCT[PRODUCT_GROUP] = _a,
DIM_PRODUCT[PRODUCT_SUPGROUP] = _b
)
If that does not solve your problem, please provide the pbix file to help you further, and remember not to log into your account when uploading the pbix file in Power BI Desktop.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi @MKPA
Try to use VALUES() instead of selectedvalues.
I hope It may resolved your issue!
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 54 | |
| 47 | |
| 39 | |
| 16 | |
| 15 |
| User | Count |
|---|---|
| 82 | |
| 69 | |
| 39 | |
| 29 | |
| 27 |