1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Integrate filters in Power BI with Angular to pass variables

Discussão em 'Angular' iniciado por Torben G, Junho 27, 2025.

  1. Torben G

    Torben G Guest

    I use Power Bi in an Angular frontend. I call the method in the ngOnInit. I would now like to filter for the “roomId” in a database called ‘persons’ and in a table of the same name “persons”.

    If I retrieve the active filter below via getFilters, it is also displayed, but the list is not filtered. Do I have to do something in the Power BI software? The roomId is all filter is somehow set automatically and I can't delete it either. Is it perhaps not overwritten?

    public ngOnInit(): void {
    this.embedPowerBIReport();
    }

    private embedPowerBIReport(): void {
    const filter: models.IBasicFilter = {
    $schema: "http://powerbi.com/product/schema#basic",
    filterType: models.FilterType.Basic,
    target: {
    table: "persons",
    column: "roomId"
    },
    operator: "In",
    values: [123]
    };

    this.embedConfig = {
    type: 'report',
    id: reportId,
    embedUrl: url,
    tokenType: models.TokenType.Embed,
    accessToken: token,
    filters: [filter],
    settings: {
    panes: {
    filters: { visible: true },
    // pageNavigation: { visible: false }
    },
    layoutType: pbi.models.LayoutType.Custom,
    customLayout: {
    displayOption: pbi.models.DisplayOption.FitToWidth
    }
    }
    };

    const reportContainer = document.getElementById('reportContainer');
    const report = powerbi.embed(reportContainer, this.embedConfig) as Report;

    report.on('loaded', () => {
    report.getFilters()
    .then(activeFilters => console.log('Active Filters:', activeFilters));

    });
    }

    Continue reading...

Compartilhe esta Página