Search code examples
powerbipowerbi-embedded

Power bi client filter with multiple columns


I have power bi client filter code below:

const basicFilter: pbi.models.IBasicFilter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Store",
    column: "Count"
  },
  operator: "In",
  values: [1,2,3,4],
  filterType: pbi.models.FilterType.BasicFilter
}

in my scenario a table can have multiple columns, so if I want to filter by multiple columns of the table then how can I do? In the above code only one column like Count is working, but how to configure for multiple columns?


Solution

  • You must define a filter for each of your conditions and pass an array with all your filters in ReportConfiguration.filters property:

    var embedConfig = {
      ...
      filters: [basicFilter1, basicFilter2, filter3]
    };
    

    or to report.setFilters method:

    report.setFilters([basicFilter1, basicFilter2, filter3])
      .catch(errors => {
        // Handle error
      });