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

Notifications

Announcements

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,990 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 74 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 55

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard