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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors