Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Replace embeded dashboard with report after tile clicked

Hello all,

 

I am sorry if there is another question on this I couldn't find.

My aim is to initially embed a dashboard into container.

Then when a tile is clicked I would like to replace the dashboard , in the current page,with the report.

I managed to extract the report id from the clicked tile and create a new config.

Then I reset the current element, the one with the embedded dashboard.

However, when I try to embed again with the new config nothing appears on the screen.

 

The tileClicked code is:

 

dashboard.on("tileClicked", function (event) {
        var clickedTile = event.detail.tileId;
        if (clickedTile = 'TILE ID') {
            //window.open('EmbedReport', '_blank');
            var url = new URL(event.detail.reportEmbedUrl);
            var c = url.searchParams.get("reportId");
            
            // Read embed application token from Model
            var accessToken2 = "@Model.EmbedToken.Token";
            
            // Read embed URL from Model
            var embedUrl2 = "@Html.Raw(Model.EmbedUrl)";
            
            var models2 = window['powerbi-client'].models;
            var config2 = {
                type: 'report',
                tokenType: models2.TokenType.Embed,
                accessToken: accessToken2,
                embedUrl: embedUrl2,
                id: c,
                permissions: models2.Permissions.All,
                settings: {
                    filterPaneEnabled: true,
                    navContentPaneEnabled: true
                }
            };
            powerbi.reset(dashboardContainer);
            var reportEmbed = powerbi.embed(dashboardContainer, config2);

        }
    });

Thank you in advance!

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.