我有一个基于App Owns Data文档和GitHub示例的可运行应用程序:
https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers
https://github.com/Microsoft/PowerBI-Developer-Samples
我的问题是尝试按照以下说明合并过滤:
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters#constructing-filters
我尝试用以下样式在js中创建过滤器:
var filter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "mytable",
column: "mycolumn"
},
operator: "In",
values: [myvalue],
filterType: 1 // pbi.models.FilterType.BasicFilter
}
...,然后将该值(过滤器)传递给配置对象的“ filters”属性,但是在加载报表时不应用该过滤器。 (没有JS错误...。)
从powerbi js Wiki示例:
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,
}
我似乎无法理解如何引用:
pbi.models.IBasicFilter
((我尝试包括对models.js的脚本引用)
Visual Studio告诉我:(JS)'类型'只能在.ts文件中使用(对于TS来说我是新手)
[这里也有一个非常相似(未答复)的帖子,How to set filters in reports power BI embedded javascript
似乎我们对RLS与JS过滤感到困惑。基于此,我们想要前者: