{"title":"Embed Power BI reports, scorecards, dashboards in pages","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-power-bi-report-parts/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-power-bi-report-parts, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-power-bi-report-parts","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Explains how to display Power BI reports on pages in Business Central","date":"2025-05-12","meta":{"topic":"how-to"},"outline":[{"level":1,"title":"Embed Power BI reports, scorecards, dashboards in pages","slug":"embed-power-bi-reports-scorecards-dashboards-in-pages","at":0,"chars":20077},{"level":2,"title":"Power BI embed framework","slug":"power-bi-embed-framework","at":1054,"chars":3996},{"level":3,"title":"Introduction","slug":"introduction","at":1436,"chars":3053},{"level":3,"title":"Examples and reference","slug":"examples-and-reference","at":4489,"chars":561},{"level":2,"title":"Embed Power BI reports in page parts","slug":"embed-power-bi-reports-in-page-parts","at":5050,"chars":10416},{"level":3,"title":"Add a Power BI Report part","slug":"add-a-power-bi-report-part","at":6325,"chars":1410},{"level":3,"title":"Add a Power BI Report part that updates data based on selected record","slug":"add-a-power-bi-report-part-that-updates-data-based-on-selected-record","at":7735,"chars":1561},{"level":4,"title":"Example 1","slug":"example-1","at":8413,"chars":883},{"level":3,"title":"Add multiple Power BI report parts","slug":"add-multiple-power-bi-report-parts","at":9296,"chars":4077},{"level":4,"title":"Use SubPageView property","slug":"use-subpageview-property","at":9571,"chars":2418},{"level":4,"title":"Use SetPageContext method","slug":"use-setpagecontext-method","at":11989,"chars":1384},{"level":3,"title":"Display same set of Power BI reports on different pages","slug":"display-same-set-of-power-bi-reports-on-different-pages","at":13373,"chars":2093},{"level":4,"title":"Example 2","slug":"example-2","at":14103,"chars":1363},{"level":2,"title":"Pin a specific Power BI element to page part","slug":"pin-a-specific-power-bi-element-to-page-part","at":15466,"chars":1100},{"level":2,"title":"Open a Power BI element expanded in its own page","slug":"open-a-power-bi-element-expanded-in-its-own-page","at":16566,"chars":1084},{"level":2,"title":"Getting information about element types","slug":"getting-information-about-element-types","at":17650,"chars":1506},{"level":2,"title":"Limitations and behavior notes","slug":"limitations-and-behavior-notes","at":19156,"chars":702},{"level":2,"title":"Related information","slug":"related-information","at":19858,"chars":219}],"text":"# Embed Power BI reports, scorecards, dashboards in pages\n> APPLIES TO: Business Central 2022 release wave (v21) and later. For earlier versions, see Adding Power BI Report Parts to Pages (Legacy)<devenv-power-bi-report-parts-legacy>.\nBusiness Central integrates with Microsoft Power BI, enabling users to create Power BI reports, scorecards, and dashboards based on Business Central data. Users can view these elements from their Power BI workspaces, but also from the Business Central client. Learn more about Power BI integration in Business Central and Power BI</admin-powerbi>.\nThe Business Central base application includes several roles centers and pages that display Power BI reports. This article provides an introduction to how you customize the application to display even more reports, scorecards, dashboards by using the Power BI embed framework of Business Central.\nIn this article, the terms Power BI element and element are often used as global terms for referring to reports, report visuals, dashboards, dashboard tiles, and scorecards.\n## Power BI embed framework\nThe Business Central base application has many objects that provide the framework for Power BI integration. The framework enables you to customize pages to include the following Power BI element types:\n Dashboard or individual dashboard tile\n Report or individual report visual.\n Scorecard. In AL, this element type is covered under Report element type.\n### Introduction\nThere are two ways to embed Power BI reports in pages. One way is to use the Power BI Report part in on a page. With this way, reports are readily visible on the page when opened and typically linked to a specific record on the page. You can design parts so that users can scroll through available reports, or set up the part to display a specific report&mdash;essentially locking it in the part.\nThe other way is to embed a report in a separate page that opens from an action the user selects on the page. This way enables reports to display in a larger screen area because they're not limited by the dimensions of the part. It provides the same experience as when a user selects Expand on a report in a page part.\nThe following table outlines the most common objects used when adding Power BI elements to pages.\nObject|Description\n-|-\nPage 6325 \"Power BI Embedded Report Part\"<https://learn.microsoft.com/dynamics365/business-central/application/base-application/page/system.integration.powerbi.power-bi-embedded-report-part>|Used to display Power BI elements in a page part.\nPage 6323 \"Power BI Element Card\"<https://learn.microsoft.com/dynamics365/business-central/application/base-application/page/system.integration.powerbi.power-bi-element-card>|Used to display Power BI elements in expanded mode on a separate page. Obsolete starting with version 26.0. Use page 6324 \"Power BI Element Addin Host\" instead.\nPage 6324 \"Power BI Element Addin Host\"<https://learn.microsoft.com/dynamics365/business-central/application/base-application/page/system.integration.powerbi.power-bi-element-addin-host>|Used to display Power BI elements in expanded mode on a separate page. This page is a devenv-page-type-usercontrolhost page type, which was introduced in 2025 release wave 1 (version 26).\nPage 6327 \"Power BI Embed Setup Wizard\"<https://learn.microsoft.com/dynamics365/business-central/application/base-application/page/system.integration.powerbi.power-bi-embed-setup-wizard>|Assisted setup guide for enabling Power BI for the fírst time.\nTable 6312 \"Power BI Displayed Element\"<https://learn.microsoft.com/dynamics365/business-central/application/base-application/table/system.integration.powerbi.power-bi-displayed-element>|Stores information about Power BI elements to be displayed for a user in each specific context. This table was introduced in 2023 release wave 2 (version 23).\nTable 6314 \"Power BI Context Settings\"<https://learn.microsoft.com/dynamics365/business-central/application/base-application/table/system.integration.powerbi.power-bi-context-settings>|Persists user settings for a specific Power BI context (like role center part, page FactBox, and so on) where the settings apply. Different parts in the same main page can have different contexts. This table was introduced in 2023 release wave 2 (version 23).\n> TIP\n> If you're working with Business Central on-premises, you find these objects in the Applications\\BaseApp\\Source\\Base Application.Source.zip\\Power BI framework folder of the installation media (DVD).\n### Examples and reference\nLearn more about the Power BI embed framework in the BCTech repo<https://github.com/microsoft/BCTech/tree/master/samples/PowerBi/>. This BCTech repo is a Microsoft open source repo that includes detailed code examples and guidelines that supplement this article.\nTo get an overview of all Power BI objects in the base application, visit Base-Application Reference for Dynamics 365 Business Central<https://learn.microsoft.com/dynamics365/business-central/application/base-application/module/base-application> and search for Power BI.\n## Embed Power BI reports in page parts\nPower BI Report part is designed to display a Power BI element inside the hosting page, like in the page's FactBox area or field group. This part makes the connection to the Power BI Service, and lets users choose which report to display. Business Central comes equipped with several pages that already include the Power BI Report part. For a list of these pages, see /power-bi-faq?tabs=designer#which-pages-in-business-central-have-the-power-bi-report-part. The main object for displaying Power BI Report part on role centers and other pages is page 6325 \"Power BI Embedded Report Part\".\nOn roles centers, you'd typically use the part to display reports related to the user's role and daily activities. In FactBoxes, you'd typically use it on list type pages to show reports related to selected records. A page can include more than one Power BI Report part.\nThe \"Power BI Embedded Report Part\" page exposes several methods for controlling when the Power BI Report part appears and the data it contains. The next sections include code examples of how to extend pages with the Power BI Report part. You can also read more in the BCTech repo<https://github.com/microsoft/BCTech/tree/master/samples/PowerBi/MultipleReportsOnRoleCenter>.\n### Add a Power BI Report part\nTo add a Power BI part to a page, you add a part control to the hosting page and associate it with page 6325 \"Power BI Embedded Report Part\" using the following syntax:\n```al\npart(<part_name>; \"Power BI Embedded Report Part\")\n{\n}\n```\nFor example, the following code adds a Power BI Report part to the Team Member Role Center page by using a page extension.\n```al\npageextension 50101 TeamMemberRCPwrBiExt extends \"Team Member Role Center\"\n{\n    layout\n    {\n        addfirst(rolecenter)\n        {\n            // Add the Power BI Report part on the role center page\n            part(PowerBIReportPart\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports';\n            }\n        }\n    }\n}\n```\nThe following code adds a Power BI Report part to the Sales Invoices List page by using a page extension.\n```al\npageextension 50100 SalesInvoicesListPwrBiExt extends \"Sales Invoice List\"\n{\n    layout\n    {\n        addfirst(factboxes)\n        {\n            // Add the Power BI Report FactBox page as the first part in the\n            // FactBox area on the Sales Invoice List page\n            part(\"Power BI Report FactBox\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports';\n            }\n        }\n    }\n}\n```\n### Add a Power BI Report part that updates data based on selected record\nWith Power BI Report parts in FactBoxes of list and card pages, in many cases you want the report to update to display data that pertains to selected record on the page. You can implement this capability by using the SetCurrentListSelection method of page 6325 \"Power BI Embedded Report Part\". The method has the following signature:\n```al\nPage.\"Power BI Report FactBox Part\".PAGE.SetCurrentListSelection(InputSelection: Variant)\n```\nThe InputSelection variant specifies the table field that uniquely identifies records in the list page. This field should resolve to the primary key of the source table.\n#### Example 1\nThis example extends the Sales Invoices page to include a Power BI Report part and uses the SetCurrentListSelection method to use the update data in the report based on the primary key No. of the Sales Invoice table.\n```al\npageextension 50100 SalesInvoicesListPwrBiExt extends \"Sales Invoice List\"\n{\n    layout\n    {\n        addfirst(factboxes)\n        {\n            part(\"Power BI Report FactBox\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports';\n            }\n       }\n    }\n\n    trigger OnAfterGetCurrRecord()\n    begin\n        // Gets data from Power BI to display data for the selected record in the list\n        // based on the primary key, in this case the \"No.\" field.\n        CurrPage.\"Power BI Report FactBox\".PAGE.SetCurrentListSelection(Rec.\"No.\");\n    end;\n}\n```\n### Add multiple Power BI report parts\nIf you want to add more than one Power BI Report part to a page, where each part can display different reports, you have to assign each part a context keyword. There are two ways to assign a context keyword, depending on the page type.\n#### Use SubPageView property\nFor role centers and other page types, you can use the properties/devenv-subpageview-property of the part control that contains the Power BI report part. In this case, the syntax for the adding a Power BI Report part is:\n```al\npart(<part_name>; \"Power BI Embedded Report Part\")\n{\n    SubPageView = where(Context = const('<context_keyword>'));\n}\n```\nFor example, suppose you wanted to add two Power BI Report parts to the Team Member Role Center page. In this case, you could use the following code:\n```al\npageextension 50101 TeamMemberRCPwrBiExt extends \"Team Member Role Center\"\n{Al\n    layout\n    {\n        addfirst(rolecenter)\n        {\n            part(PowerBIReportPart; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports';\n                SubPageView = where(Context = const('TeamMemberReportsPart1'));\n            }\n            part(PowerBIReportPart2; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports';\n                SubPageView = where(Context = const('TeamMemberReportsPart2'));\n            }\n        }\n    }\n}\n```\nYou can do the same for FactBoxes on list and card type page. For example, suppose you wanted to add two Power BI Report parts in the FactBox of the Sales Invoices List. In this case, you could use the following code:\n```al\npageextension 50100 SalesInvoicesListPwrBiExt extends \"Sales Invoice List\"\n{\n    layout\n    {\n        addfirst(factboxes)\n        {\n            part(\"Power BI Report FactBox 1\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports 1';\n                SubPageView = where(Context = const('DetailedSalesInvoiceReports1'));\n\n            }\n            part(\"Power BI Report FactBox 2\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports 2';\n                SubPageView = where(Context = const('DetailedSalesInvoiceReports2'));\n            }\n       }\n    }\n\n    trigger OnAfterGetCurrRecord()\n    begin\n        CurrPage.\"Power BI Report FactBox 1\".PAGE.SetCurrentListSelection(Rec.\"No.\");\n        CurrPage.\"Power BI Report FactBox 2\".PAGE.SetCurrentListSelection(Rec.\"No.\");\n    end;\n}\n```\n#### Use SetPageContext method\nFor list and card type pages, another way to assign context keywords is to call the SetPageContext method of the \"Power BI Embedded Report Part\" page.\n```al\nprocedure SetPageContext(InputContext: Text)\n```\nBy calling SetPageContext, you can get the same results as you do with the SubPageView property. For example:\n```al\npageextension 50100 SalesInvoicesListPwrBiExt extends \"Sales Invoice List\"\n{\n    layout\n    {\n        addfirst(factboxes)\n        {\n            part(\"Power BI Report FactBox 1\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports 1';\n\n            }\n            part(\"Power BI Report FactBox 2\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports 2';\n            }\n       }\n    }\n\n    trigger OnOpenPage()\n        begin\n            CurrPage.\"Power BI Report FactBox 1\".PAGE.SetPageContext('DetailedSalesInvoiceReports1');\n            CurrPage.\"Power BI Report FactBox 2\".PAGE.SetPageContext('DetailedSalesInvoiceReports2');\n\n    trigger OnAfterGetCurrRecord()\n    begin\n        CurrPage.\"Power BI Report FactBox 1\".PAGE.SetCurrentListSelection(Rec.\"No.\");\n        CurrPage.\"Power BI Report FactBox 2\".PAGE.SetCurrentListSelection(Rec.\"No.\");\n    end;\n}\n```\n### Display same set of Power BI reports on different pages\nSuppose you want setup Power BI Report parts on different pages so the parts have the following behavior:\n They show the same report selected by the user on all pages. When the user switches to another report on one page, it switches on all pages.\n When the user enables or disables a report in the Power BI Report part on one page, it's also enabled or disabled in the parts on other pages.\nTo configure this functionality, you give each Power BI Report part on the different pages the same context keyword. In other words, use the same values for the SubPageView property for the parts on all pages:\n```al\nSubPageView = where(Context = const('<context_keyword>'))\n```\n#### Example 2\nSuppose you want to display the same reports on the Sales Invoices page and Sales Orders page. In this case, you could use the following line of code in both the Sales Invoices and Sales Orders pages, where Sales is the common context identifier:\n```al\npageextension 50100 SalesInvoicesListPwrBiExt extends \"Sales Invoice List\"\n{\n    layout\n    {\n        addfirst(factboxes)\n        {\n            part(\"Power BI Report FactBox\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports';\n                SubPageView = where(Context = const('sales'));\n            }\n        }\n    }\n\n    trigger OnAfterGetCurrRecord()\n    begin\n        CurrPage.\"Power BI Report FactBox\".PAGE.SetCurrentListSelection(Rec.\"No.\");\n    end;\n}\n\npageextension 50101 SalesOrdersPwrBiExt extends \"Sales Orders\"\n{\n    layout\n    {\n        addfirst(factboxes)\n        {\n            part(\"Power BI Report FactBox\"; \"Power BI Embedded Report Part\")\n            {\n                ApplicationArea = Basic, Suite;\n                Caption = 'Power BI Reports';\n                SubPageView = where(Context = const('sales'));\n            }\n        }\n    }\n\n    trigger OnAfterGetCurrRecord()\n    begin\n        CurrPage.\"Power BI Report FactBox\".PAGE.SetCurrentListSelection(Rec.\"No.\");\n    end;\n}\n```\n## Pin a specific Power BI element to page part\nThe framework lets you show a specific report, report visual, scorecard, dashboard, or dashboard tile. Users can't switch to other elements or change visuals. For example, add a part that shows a single report visual, like the one in the following figure. The menu doesn't include the Select reports, Next, and Previous actions, so users can't access other reports:\nTo implement this scenario, use key objects like the Power BI Displayed Element and Power BI Context Settings tables. The Power BI Displayed Element table stores information about the elements you display for users in specific contexts, and the Power BI Context Settings table saves user settings for a specific Power BI context.\nFor a detailed code example that demonstrates how to pin a specific Power BI report to a page part in Business Central, go to https://github.com/microsoft/BCTech/blob/master/samples/PowerBi/PBI23samples/AddCustomerCardLockedPart.PageExt.al<https://github.com/microsoft/BCTech/blob/master/samples/PowerBi/PBI23samples/AddCustomerCardLockedPart.PageExt.al>.\n## Open a Power BI element expanded in its own page\nFrom the Power BI Embedded Report Part, users select the Expand action to open the report in a separate page. You can create a similar experience by using AL code to add an action on a page that opens a specific element in expanded mode.\nFor this scenario, use the Power BI Displayed Element and Power BI Context Settings tables, just like when you pin a specific element to a page part. Instead of using the Power BI Embedded Report Part to show the element, use one of the following pages depending on your Business Central version:\n For version 26 and later, use the Power BI Element Addin Host page. For detailed code examples, see https://github.com/microsoft/BCTech/tree/master/samples/PowerBi/PBI23samples<https://github.com/microsoft/BCTech/tree/master/samples/PowerBi>.\n For version 25 and earlier, use the Power BI Element Card page. For detailed code examples, see https://github.com/microsoft/BCTech/tree/master/samples/PowerBi/PBI23samples<https://github.com/microsoft/BCTech/tree/master/samples/PowerBi/PBI23samples>.\n## Getting information about element types\nTo display a specific Power BI element, such as a report, visual, or dashboard, you need to obtain some information about the element. Here are some tips to help you get this information:\n For any element you want to display, you need its embedUrl and ID. You can get this information by using the Power BI REST API for the element and selecting Try it:\n   https://learn.microsoft.com/rest/api/power-bi/reports/get-reports - Typically, the embedURL has the format `https://app.powerbi.com/reportEmbed?reportId=<id>&config=<config>`.\n   https://learn.microsoft.com/rest/api/power-bi/dashboards/get-dashboards - Typically, the embedURL has the format `https://app.powerbi.com/dashboardEmbed?dashboardId=<id>&config=<config`.\n   Get scorecards<https://learn.microsoft.com/rest/api/power-bi/scorecards(preview)/get>\n For report visuals, you also need the page name and the visual name.\n  To get this information, open the report in Power BI. Hover over the visualization to reveal and select More options (...) > Share > Link to visual > Copy. The link has the following format:\n  `https://app.powerbi.com/groups/me/reports/<reportID>/<page_name>?ctid=<ctid>&pbi_source=shareVisual&visual=<visual_name>&height=nnnn&width=nnnn&bookmarkGuid=<guid>`\n For dashboard tiles, you also need the tile ID, which you can get with Power BI REST API.\n   https://learn.microsoft.com/rest/api/power-bi/dashboards/get-tiles - You need to provide the dashboard ID to run the request.\n## Limitations and behavior notes\n The SubPageView property for the Power BI parts only supports constant values, not filters.\n If you use both the SubPageView property and the SetPageContext method for specifying a context at the same time, the SetPageContext value overwrites the value specified in the SubPageView property.\n Dynamically changing the context (for example, by calling SetPageContext in the OnAfterGetCurrRecord) isn't recommended and could lead to unexpected results.\n Role center pages have no triggers, which means there's no way to call the SetPageContext method. As a consequence, any Power BI part in the role center would have the same context: the current user's profile/role.\n## Related information\nGet Started with AL<devenv-get-started>\ndevenv-adding-a-factbox-to-page\ndevenv-pages-overview\ndevenv-how-publish-and-install-an-extension-v2\nExtract data from Business Central<devenv-extract-data>"}