web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Unanswered

Filter power bi report in power pages site on accountnumber

(0) ShareShare
ReportReport
Posted on by 39
Hello experts,
 
I have a power bi report in my portal. I want to filter the report on Accountnumber. So when a person is logged-in he only sees the data that is connected to the Account he is assigned to.
 
Can someone help me out with this? 
 
Thank you
 
Categories:
I have the same question (0)
  • SaiRT14 Profile Picture
    1,988 Super User 2025 Season 2 on at
    Filter power bi report in power pages site on accountnumber
    Hi  ,
     
    Use Row-Level Security (RLS) in Power BI combined with Power Pages security. Here’s how you can set this up:
     
    Open your Power BI report in Power BI Desktop. Go to the Modeling tab and select Manage roles. Create a new role (e.g., "AccountFilter"). Apply a DAX filter on the table containing account data. For example: [AccountNumber] = USERPRINCIPALNAME() Publish the Report to Power BI Service:

    Embed the Report in Power Pages: Add the Power BI report to your Power Pages site using the Power BI Embedded component or an iframe with an embed link. Use the Power Pages Design Studio or custom HTML/JavaScript to embed the report.

    Enable Single Sign-On (SSO): Configure SSO between Power BI and your portal using Azure AD authentication. This ensures the logged-in user's identity is passed to Power BI for RLS.

    In Power Pages, fetch the user's assigned AccountNumber using Liquid templates or JavaScript. {% assign accountNumber = user.accountnumber %}

    Use the Power BI JavaScript API to pass the AccountNumber dynamically to the report. let models = window['powerbi-client'].models;
    let config = {
      type: 'report',
      embedUrl: 'https://app.powerbi.com/...yourReportEmbedUrl...',
      accessToken: 'yourAccessToken',
      settings: {
        filterPaneEnabled: false,
        navContentPaneEnabled: false
      }
    };

    // Apply filter on AccountNumber
    let accountFilter = {
      $schema: "http://powerbi.com/product/schema#basic",
      target: {
        table: "YourTableName",
        column: "AccountNumber"
      },
      operator: "In",
      values: ["{{ accountNumber }}"]
    };
    let reportContainer = document.getElementById('reportContainer');
    let report = powerbi.embed(reportContainer, config);
    report.on("loaded", function() {
      report.setFilters([accountFilter]);
    });
     
    try out

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Pages

#1
Jon Unzueta Profile Picture

Jon Unzueta 87 Super User 2025 Season 2

#2
Shafiuddin Profile Picture

Shafiuddin 45

#3
Fubar Profile Picture

Fubar 44 Super User 2025 Season 2

Last 30 days Overall leaderboard