angular - Power BI 嵌入 Angular UI 应用程序

标签 angular powerbi powerbi-embedded

我们已经开发了一个 Power BI 报告,我们需要将 Power BI 报告嵌入到 Angular 应用程序中。 Angular 应用程序使用 OAuth 身份验证。我们已经了解了如何嵌入 Power BI 报告(如链接 - 嵌入客户 - https://docs.microsoft.com/en-us/power-bi/developer/embedding#embedding-for-your-customers 中所述)

我们还要求在 Power BI 报告中进行细粒度授权。是否可以根据登录到 Angular UI 应用程序的用户过滤数据?

最佳答案

是的,有可能,我用过 Ngx-power-bi .尝试这个:

private powerBiService: NgxPowerBiService;
private pbiContainerElement: HTMLElement;

private reportId = "YOUR REPORT ID";
private groupId = "YOUR GROUP ID";
private filterPaneEnabled= false;
private navContentPaneEnabled= true;
    
constructor(private authService: AuthService,private dashboardService:DashboardService) {
this.powerBiService = new NgxPowerBiService();
}

ngOnInit() {

//Get the token from backend, You may use switchMap or flatMap 
//to get the user data (table, column, value etc)

this.dashboardService.getAccessToken().pipe(untilDestroyed(this)).subscribe(token=>{
    const config = {
        type: 'report',
        id: this.reportId,
        embedUrl:
          'https://app.powerbi.com/reportEmbed?' +
          'reportId='+this.reportId +
          '&groupId='+ this.groupId,
        accessToken:token.accessToken,
        settings: {
          filterPaneEnabled: this.filterPaneEnabled,
          navContentPaneEnabled: this.navContentPaneEnabled
        },
        filters:[{
            $schema: "http://powerbi.com/product/schema",
            filterType:1,
            target: {
              table: "Master", // filter table
              column: "companyId" // filter column
            },
            operator: "In",
            values: [101]   // value that you need to filter

          }]
      };
    this.pbiContainerElement = <HTMLElement>(document.getElementById('pbi-container'));
    this.powerBiService.embed(this.pbiContainerElement, config);
})

   
   

关于angular - Power BI 嵌入 Angular UI 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58178600/

相关文章:

powerbi - Power BI (DAX) 中 EOMONTH() 的相反词是什么

ruby-on-rails - 如何在 Rails 应用程序中嵌入 PowerBI Tile? (并对其应用过滤器)

javascript - 图像上传功能在 Angular 6 中不起作用

angular - ** 中的错误不是 NgModule

powerbi - 如何计算power bi的平均库存?

powerbi - Power BI 中的 Post 方法

excel - 如何在 Power BI 中更改/设置单元格的背景颜色 [基于行]

javascript - 在服务器端调用 MVC 中使用 javascript 变量

当应用程序处于前台时,Angular 8 firebase 推送通知不起作用

angular - ngx-charts 热图使用 tooltipTemplate 自定义工具提示