Forum Discussion

EJones's avatar
EJones
Frequent Visitor
8 years ago
Solved

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?  

 

 

 

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

3 Replies

  • krisztb's avatar
    krisztb
    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.

    • EJones's avatar
      EJones
      Frequent Visitor

      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.