Forum Discussion
Get value from C# app to Power BI Embedded
Thanks v-ljerr-msft for your answer but that's what I've just donde and it works perfectly. What I want now is to get the URL value into power BI and this way that I can execute an Stored Procedure to bring only the data that I want from SQL Server. I mean, for example, in my app I log in with a user that has as idFromURL = "USER1" and this id is right now being passed by url and is filtering all the data of all the users (because the database bring everything) by this id but if I can get this id into the moment that power bi goes to de DB and filter it by an SP (or something that just bring me the data respect that id). I expect something like this:
Sql.Database("server", "database", [Query="EXEC sp_BringDataByUserID @User = 'idFromURL' "])
Hope you can help me ! :D
Juramirez this link really save my life :)
https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedded-rls/
ONE line difference. Just a small adjustment on power bi desktop.
Also, they updated the sample https://github.com/Microsoft/PowerBI-Developer-Samples/tree/master/App%20Owns%20Data
Enjoy
- Juramirez8 years ago
Resolver I
- Juramirez8 years ago
Resolver I
Hi gilbertocrespo.
How did you get the value from the URL? I mean, i'm passing an ID by URL but i don't know how to get this value in my advanced editor to call an StoredProcedure (SQL Server) with this ID as value for my StoredProcedure. I want something like this:
Sql.Database("server", "database", [Query="EXEC sp_BringDataByUserID @User = 'idFromURL' "])
Regards
- gilbertocrespo8 years ago
Advocate I
I guess you are focusing on Stored Procedure too much. Let the PowerBI does this service to you.
On controller Home\HomeController.cs, before to generate token:
var generateTokenRequestParameters = new GenerateTokenRequest("View", null, identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: "5", datasets: new List<string> { report.DatasetId }, roles: new List<string> { "clientid" }) });
5 is my clientId
clientid is the collumn name I created on each report
On PowerBI Desktop:
Enter the following DAX expression on your report:
[clientid] = VALUE( USERNAME() )
note: I'm using value() to converts my string into int
This way your data is filtered BEFORE to bring it to PowerBi Service.