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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / How to dynamically hid...
Power Pages
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:
I have the same question (0)
  • SaiRT14 Profile Picture
    1,992 Super User 2025 Season 1 on at
    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);
    });
     
     
  • PN-28081327-0 Profile Picture
    73 on at
    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
     
  • Verified answer
    PN-28081327-0 Profile Picture
    73 on at
    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.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 50

#2
Valantis Profile Picture

Valantis 26

#3
omkarsupreme Profile Picture

omkarsupreme 24

Last 30 days Overall leaderboard