Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Answered

How to dynamically hide a Power Bi report tab

(0) ShareShare
ReportReport
Posted on by 73
Hi
 
I have an embedded power bi report, which has a number of tabs, in a power pages portal page. I would like to hide/show some of the tabs depending upon some logic
 
Here is some test code I have been playing with 
 
        var reportContainer = $(".powerbi")[0];
        let report = powerbi.get(reportContainer);
        let reportPages = await report.getPages();
        let log = "Report pages: ";
        try {
            reportPages.forEach(function(page){
            if ( page.displayName.includes("Spend") ) {
                log += "\n" + page.name + " - " + page.displayName + " HIDE";
            } else {
                log += "\n" + page.name + " - " + page.displayName;
            }
            })
            console.log("reportContainer = " + reportContainer);
            console.log("report = " + report);
            console.log("reportPages = " + reportPages.length );
            console.log(log);
        }
        catch (error) {
            console.log("ERROR>> " + error);
        }
 
This writes to the console log correctly with HIDE appended to the page name and page displayName where expected.
Can I actually hide the page here using the page object, which property should I be setting?
 
Regards
Categories:
  • Verified answer
    PN-28081327-0 Profile Picture
    73 on at
    How to dynamically hide a Power Bi report tab
    Sorted it. Used report.deletePage. I don't want to make the page visible again, so delete works in this instance
     
    However need to be careful how to go about it. Within the forEach loop I build an array of page.name for the pages to delete. Then once the reportPages has been processed, loop through this new array deleting the pages in turn.
  • PN-28081327-0 Profile Picture
    73 on at
    How to dynamically hide a Power Bi report tab
    Thanks SaiRT14
     
    Not what I was after. My bad, didn't explain clearly enough what I'm after. I want to hide the tab completely. In the example code I posted the affect I want is to hide each table which includes 'Spend'. So these tabs would not be visible
     
  • SaiRT14 Profile Picture
    1,988 Super User 2025 Season 1 on at
    How to dynamically hide a Power Bi report tab
    try the following
    let pageName = "YourPageName"; // Define the page you want to navigate to
    report.getPages().then(function(pages) {
        pages.forEach(function(page) {
            if (page.name === pageName) {
                page.setActive();
            }
        });
    }).catch(function(error) {
        console.log(error);
    });
     
     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35