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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mcostner
Regular Visitor

Dynamically Update Query Based on User ID - Power BI Embedded

Hi Everyone,

 

I recently embedd a Power BI report into a web app. Data are gathered from a SQL Server database.

 

When a user logs into the web app, I'd like for the queries to update based on that user's ID. So, something like the statement below where the "userid" value dynamically changes.

 

select * from table where userid = 1234

 

My initial thought was to use row level security, but since we have hundreds of users, setting up the individual role for each user seems like an inefficient process. I don't want to add the userid as a filter since a user could clear the filter and then see other user's information.

 

Passing the userid as part of a URL parameter would be ideal but that doesn't seem like it is possible according the link below.

 

https://docs.microsoft.com/en-us/power-bi/service-url-filters

 

Has anyone come across this requirement before? Any thoughts or suggested solutions would be greatly appreciated.

 

Thanks!

 

Michael

3 REPLIES 3
RyanStewart
Frequent Visitor

Was there ever a good resolution to this issue?  I am curious about doing a similar thing.  The links provided about the API were not clear to me.

Any more information?

v-micsh-msft
Microsoft Employee
Microsoft Employee

Have you checked the Power BI Embeded Query parameter API?

 

If the UserId could be defined as a Query Parameter, then you could take use of the API to update it.

Check the API refernece:

Set parameters

 

Regards,

Michael

 

Hi Michael, 

 

I recently asked a question about Query Parameters API and not had a reply yet

 

When Setting Parameters I am encountering an issue, it may also help Michael above with his query parameters if he has a problem. 

http://community.powerbi.com/t5/Developer/Query-Parameters-API/m-p/391898#M11635

 

Thanks
Alexander

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.