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
EJones
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
krisztb
Power BI Team
Power BI Team

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
krisztb
Power BI Team
Power BI Team

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.

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.  

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