Skip to main content

Notifications

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:
  • SaiRT14 Profile Picture
    SaiRT14 1,941 Super User 2025 Season 1 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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,318 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,111 Most Valuable Professional

Leaderboard