The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am using trying to use the CountRows function in an expression to show all selected values of a parameter in a Paginated Report
The function I have seen online from others is: IIF(COUNTROWS("Table1") = (Parameters!Table1.Count), "All", JOIN(Parameters!Table1Supplier.Value, ", "))
However this yields an error "Object reference not set to an instance of an object".
When I try to break down the expression, I can use =COUNTROWS("Table1") to get a value. But when I try to add anything else to this expression, the error gets thrown. If I try, =IF(COUNTROWS("Table1") > 1..... this is an error. If i try, =2+COUNTROWS("Table1"), this is an error.
Can anyone help?
Hi @kmei001 ,
I have tested and this works for me, can you share more detail about this, what is the error when IF(COUNTROWS("Table1") > 1?
Best Regards
Community Support Team _ chenwu zhu
Hi @kmei001
That's not a formula for Power BI. Might be Access? Might be SSRS? Guessing from the IIF function.
Based on the description of your issue being "an expression to show all selected values of a parameter in a Paginated Report" a DAX expression that would work is something like this
CONCATENATEX(
VALUES(Parameters[FieldName])
", "
)
Hope this helps...