Forum Discussion
Get value from C# app to Power BI Embedded
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
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.
- Juramirez8 years ago
Resolver I
Thanks for your reply gilbertocrespo
With the code that you give me is like filtering a dataset that has all the Clients, am I wrong? I mean, you're importing all database and with this you're allowing to see the data refered to the clientid that is getting in. This way the dataset size is the same for a huge Client than a small client or not? I want a SP because this way (as I thought) I can bring the data directly (not filtering or by permissions) from my DB only for the client that is getting in and this way the size will be different depending the client size.
Regards
- gilbertocrespo8 years ago
Advocate I
Hello my friend Juramirez,
My current database is small and i don't see any difference.
Filter does that you talking about, because it works after the report is built.
I'm not 100% sure, but RLS don't does it.
v-ljerr-msft Could you help us solving this question?
Does the dataset size brought by powerBI service is the same if I filter it by using RLS? I mean, Does the Power BI just hide a content or includes a WHERE clause when building a dataset transported?
- Juramirez8 years ago
Resolver I
Ok, thanks for your explain. The question that you're doing to v-ljerr-msft is the one that i need to solve. Any answer for this one?
Thanks in advance.