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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rnehrboss
Helper II
Helper II

Trouble embedding a visual

I'm having trouble using the javascript library to embed a visual.

 

I've successfully embedded whole dashboards with this code:

____________________________________________

var embedConfiguration= {
type: 'report',
tokenType: models.TokenType.Embed,
id: "XXXXXXXXXXXXXXXXXXXXX", // the report ID
pageView: "fitToWidth",
embedUrl: "https://app.powerbi.com/reportEmbed?reportId=XXXXXXXXXXXXXXXXXXXXX",
accessToken: "XXXXXXXXXXXXXXXXXXXXX",
permissions: models.Permissions.All,
viewMode: models.ViewMode.Edit,
//pageName: 'ReportSectionb2cb0b41ed7bcb4c2062',
// pageName = 'ReportSectione8ca3274720a027d512c',
//type: 'visual',
//visualName: '502c9649ae1f8fbe7f07'
};

var $reportContainer = $('#reportContainer');

var report = powerbi.embed($reportContainer.get(0), config);

__________________________________________________________

 

The report works great, but if I change the type to "visual" by and uncomment the page name and visual name, I can never get a single visual to work.

 

Anyone know what I might be missing?

 

Thanks!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @rnehrboss ,

 

I suggest you to try this code to embed a report visual.

interface IVisualLoadConfiguration {
    accessToken?: string;
    embedUrl?: string;
    id?: string;
    pageName: string;
    tokenType?: models.TokenType;
    type: string;
    visualName: string;
}

For more details, you may refer to this offical blog.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @rnehrboss ,

 

I suggest you to try this code to embed a report visual.

interface IVisualLoadConfiguration {
    accessToken?: string;
    embedUrl?: string;
    id?: string;
    pageName: string;
    tokenType?: models.TokenType;
    type: string;
    visualName: string;
}

For more details, you may refer to this offical blog.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

rnehrboss
Helper II
Helper II

no love here?   

Anyone know how?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.