0
votes

I have a working app based on the App Owns Data documentation & GitHub sample:

https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers

https://github.com/Microsoft/PowerBI-Developer-Samples

My issue is with attempting to incorporate filtering as per the following:

https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters#constructing-filters

I've tried creating a filter in js in the style of:

var filter  = {
    $schema: "http://powerbi.com/product/schema#basic",
    target: {
    table: "mytable",
    column: "mycolumn"
    },
    operator: "In",
    values: [myvalue],
    filterType: 1 // pbi.models.FilterType.BasicFilter
}

...and then passing that value (filter) to the "filters" property of the config object, however the filter is not applied when the report loads. (No JS errors....)

From the powerbi js wiki example:

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: 1 // pbi.models.FilterType.BasicFilter,
}

I can't seem to understand how to reference :

pbi.models.IBasicFilter

(I've tried including a script reference to the models.js)

Visual studio tells me: (JS) 'Types' can only be used in a .ts file (I am new to all things TS)

There is a very similar (unanswered) post here also How to set filters in reports power BI embedded javascript

1

1 Answers

0
votes

It seems we were confused about RLS vs JS filtering. We wanted the former, based on this:

https://docs.microsoft.com/en-us/power-bi/developer/embedded-row-level-security#using-rls-vs-javascript-filters