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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
kmei001
Frequent Visitor

COUNTROWS Error

 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?

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

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?

vchenwuzmsft_0-1644913950698.png

Best Regards

Community Support Team _ chenwu zhu

 

littlemojopuppy
Community Champion
Community Champion

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...

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors