【发布时间】:2020-05-06 05:00:21
【问题描述】:
我有一个基于 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
}
...然后将该值(过滤器)传递给配置对象的“过滤器”属性,但是在报告加载时不会应用过滤器。 (没有 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) 'Types' 只能在 .ts 文件中使用(我对所有 TS 都是新手)
这里也有一个非常相似(未答复)的帖子How to set filters in reports power BI embedded javascript
【问题讨论】: