cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Data Set Parameter Not Being Passed to DB Query

I've got a Report Server data set that is sourcing from Netezza.  I need to pull values from a table based on the current user's username.  I've added a @CurrentUser parameter to my query, and I've defined that parameter in the data set options as:

 

=iif(InStr(User!UserID,"\") <> 0, UCase(Right(User!UserID, Len(User!UserID) - InStr(User!UserID,"\"))), UCase(User!UserID))

 

When I try to run my query in Report Builder, I get a Define Query Parameters popup that identifies my @CurrentUser parameter and asks for the Parameter Value and the Data Type.  If I save the data set and try to preview the data on the Report Server, I get an error message that states "The data set could not be processed because it requires non empty parameters". 

 

I guess my first question is whether it is even possible to use the User!UserID function in a data set on the Report Server.  Second, why is it not recognizing that I have defined this parameter in the data set?  

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power BI Team
Power BI Team

Re: Data Set Parameter Not Being Passed to DB Query

Data preview for data sets with parameters has limitations (even when they rely on expressions), but the data sets should work fine once you use them from reports.

I assume you are designing a shared data set. Consider making the @CurrentUser parameter internal if you don't plan to override it from actual reports. Once the data set is saved you can test it by creating a report that uses it. Just build one in Report Builder and hit preview on the report itself.

 

Let me know if you still have problems with data sets.

View solution in original post

3 REPLIES 3
Highlighted
Power BI Team
Power BI Team

Re: Data Set Parameter Not Being Passed to DB Query

Data preview for data sets with parameters has limitations (even when they rely on expressions), but the data sets should work fine once you use them from reports.

I assume you are designing a shared data set. Consider making the @CurrentUser parameter internal if you don't plan to override it from actual reports. Once the data set is saved you can test it by creating a report that uses it. Just build one in Report Builder and hit preview on the report itself.

 

Let me know if you still have problems with data sets.

View solution in original post

Highlighted
Frequent Visitor

Re: Data Set Parameter Not Being Passed to DB Query

Thanks, I see that it does correctly pass the parameter value through to the query now when creating a KPI.  

 

Follow-up question: Is there a way to make KPIs refresh automatically when someone visits the report server page and have it refresh based off of the username of whoever is visiting?  The values of my KPIs are shown based on the username of the person who created them, but if I log in as a different user, I still see those same values even though I need it to update based on the current user.  

Highlighted
Power BI Team
Power BI Team

Re: Data Set Parameter Not Being Passed to DB Query

There is a way to have the KPI get latest data using cache refresh plan for the underlying data set: https://community.powerbi.com/t5/forums/replypage/board-id/ReportServer/message-id/5062

 

 

Note that the refresh is time based, you can make the cache expire every minute, but if you want to trigger a refresh each time a user visits the server, you'll need to create a custom solution (e.g. schedule a refresh job using SQL Agent).

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors