Power BI Embedded - Javascript API & 过滤
Power BI Embedded - Javascript API & Filtering
我有一个基于 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) 'Types' 只能用在 .ts 文件中(我对所有 TS 都是新手)
这里也有一个非常相似(未回答)post How to set filters in reports power BI embedded javascript
我们似乎对 RLS 与 JS 过滤感到困惑。我们想要前者,基于此:
我有一个基于 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) 'Types' 只能用在 .ts 文件中(我对所有 TS 都是新手)
这里也有一个非常相似(未回答)post How to set filters in reports power BI embedded javascript
我们似乎对 RLS 与 JS 过滤感到困惑。我们想要前者,基于此: