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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Seanan
Solution Supplier
Solution Supplier

Error when passing multiple values to a parameter in report builder

I have a report builder report that uses an Azure SQL database stored procedure for it's dataset.

In this report I have 2 parameter that are single value only and I now want to add a third parameter that allows multiple values to be passed to it.

 

PowerBIReportBuilder_L4IEIjCAne.png

 

I've setup my dataset properties -> parameters to include the new parameter value:

 

PowerBIReportBuilder_dK4jARfsp0.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

However when I enter my values I get the following error:

 

OUsbIRWCQU.png

 

 

 

 

 

PowerBIReportBuilder_zvOc9rGcQI.png

 

 

 

 

 

 

 

 

 

 

 

My stored procedure has a variable at the top:

@CandidateId int

and my where statement has the line:

 

AND CandidateId IN (@CandidateId)

 

 

Any ideas what may be causing this issue and how I can pass multiple values into this parameter?

3 REPLIES 3
josef78
Memorable Member
Memorable Member

Try, do not use "Parameters" page in DataSet configuration (left this empty), and enter parameter name directly into SQL "Query" like this

AND CandidateId IN (@CandidateId)

 

v-xiandat-msft
Community Support
Community Support

Hi @Seanan ,

According to your error message . It looks like CandidateId is an nvarchar datatype in the table and you've passed an int through your procedure, either use a forced conversion and convert @CandidateId to an nvarchar, or change the CandidateId datatype to an integer in the table.

 

DECLARE @CandidateID_coast NVARCHAR(15)

SET @CandidateID_coast = CAST(@CandidateID AS NVARCHAR)

 

Then use  @CandidateID_coast instead of @CandidateId in SELECT, INSERT and WHERE clause.

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xiandat-msft 

Thanks for your swift response.

 

This is the part that is confusing me because in my source stored procedure the data type for CandidateId is an integer, as shown below:

PowerBIReportBuilder_iDN1JpjoTp.png

 

 

 

I tried what you mentioned but it throws the same error because the where statements looks like this:

WHERE CandidateId IN (@CandidateId_coast)

But CandidateId is a integer and CandidateId_cost is an nvarchar.

 

I feel like the error comes the way multiple values are concatenated and then passed to the parameter, I've tried a few different expressions to break them up and pass them into the (@CandidateId) parameter but I haven't had any success.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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