[Power BI Embed Reactive] How to control Power BI filter by Javascript or Embed URL?
Forge component by Rutger Buijzen
Application Type
Service Studio Version
11.11.13 (Build 47944)

Hi all,

I would like to control Power BI filter by javascript or Embed URL. I have checked following link:

1. https://docs.microsoft.com/zh-tw/javascript/api/overview/powerbi/control-report-filters#basic-filter

2. https://playground.powerbi.com/en-us/dev-sandbox

I have following the step in https://playground.powerbi.com/en-us/dev-sandbox and use my own Power BI Report to test, it works on add filter. 

However, it did not work when I try to add filter javascript in my Outsystems code.

Table info:

Table Name: Query2

Column Name: Code

Below photo is the test code on Power BI dev-sandbox, it works !

Below code in my Outsystems code, it did not work...

// Read embed application token from Model
var accessToken = "+EmbedToken+";

// Read embed URL from Model
var embedUrl = "+EmbedUrl+";

// Read report Id from Model
var embedReportId = "+EmbedReportId+";

// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;

// Embed configuration used to describe what and how to embed.
// This object is used when calling powerbi.embed.
// This also includes settings and options such as filters.
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
var config = {
    type: 'report',
    tokenType: models.TokenType.Embed,
    accessToken: accessToken,
    embedUrl: embedUrl,
    id: embedReportId,
    permissions: models.Permissions.All,
    settings: {
            panes: {
                filters: {
                    expanded: false,
                    visible: true
                pageNavigation: {
                    visible: true

// Get a reference to the embedded report HTML element
var reportContainer = document.getElementById("+reportContainerDivId+");

// Embed the report and display it within the div container.
var report = powerbi.embed(reportContainer, config);

// Create the filter object. For more information see https://go.microsoft.com/fwlink/?linkid=2153364
var filter = {
    $schema: 'http://powerbi.com/product/schema#basic',
    target: {
        table: 'Query2',
        column: 'Code'
    operator: 'In',
    values: [103,105],
    filterType: models.FilterType.BasicFilter,

// Replace all report's filters.
try {
    await report.updateFilters(models.FiltersOperations.ReplaceAll, [filter]);
    console.log('All the report filters were replaced.');
catch (errors) {


Please advise how I can add a filter for this embed report, thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.