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.
Is it possible, with embedded report, to filter content automatically based on the UID logged ito the app which the report is embedded?
@twalsh0625 wrote:
Is it possible, with embedded report, to filter content automatically based on the UID logged ito the app which the report is embedded?
Yes.
If the UID you mean is a Power BI Account, you can use Embedding with Power BI users and set Power BI Row Level Security.
If the UID you mean is the userID in your own app, you'll have to use Embedding with non-Power BI users. As to filter or using RLS, RLS used to work for the old embedding model(deprecated), for the new model, the RLS feature is on the roadmap and would be released in next quarter. So at this moment, use filter in the Power BI Javascript API can be the only workaround. See a demo below.
<html> <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script> <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script> <script type="text/javascript"> window.onload = function () { var uid= ["uid1"]; //get the uid with javascript from your page var Filter = { $schema: "http://powerbi.com/product/schema#basic", target: { table: "Table", column: "UID" }, operator: "Contains", values: uid } // Read embed application token from Model var accessToken = "H4sIAAAAAAAEAB2 xxxxx uCwAA"; // Read embed URL from Model var embedUrl = "https://app.powerbi.com/reportEmbed?reportId=1f1d9145-738a-4d20-ab5b-1236b283e942&groupId=73e1a3c6-08c4-4651-aa04-2bb701a573c7"; // Read report Id from Model var embedReportId = "1f1d9145-738a-4d20-ab5b-1236b283e942"; // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; // Embed configuration used to describe the what and how to embed. // This object is used when calling powerbi.embed. // This also includes settings and options such as filters. // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. var embedConfiguration = { type: 'report', tokenType: models.TokenType.Embed, accessToken: accessToken, embedUrl: embedUrl, id: embedReportId, permissions: models.Permissions.All, filters:[Filter,Filter2], settings: { filterPaneEnabled: true, navContentPaneEnabled: true } }; var $reportContainer = $('#reportContainer'); var report = powerbi.embed($reportContainer.get(0), embedConfiguration); } </script> <div id="reportContainer" powerbi-settings-nav-content-pane-enabled="true" powerbi-settings-filter-pane-enabled="true"></div> </html>
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |