PowerBI:如何将TupleFilter与powerbi-client一起使用? [英] PowerBI: How to use TupleFilter with powerbi-client?
问题描述
我正在尝试在 TupleFilter href = https://www.npmjs.com/package/powerbi-client rel = nofollow noreferrer> powerbi-client ,因为我需要根据两个不同的列过滤数据,并在两个列之间使用OR语句(同一表中有2个不同的列,或者可能在2个不同的列中),请检查这个问题。
I am trying to use TupleFilter in powerbi-client, since I need to filter data based on two different columns with OR statement between them (2 different columns in the same table or may be in 2 different ones), check this question out.
当我阅读在本文档中,元组过滤器可以做到这一点。
As I read in this docs, tuple filter can do this.
但是,当我尝试将它与 report.setFilters(filters)
函数一起使用时,我从setFilters函数中得到了此错误:未定义的属性无效。
However, when I tried to use it with report.setFilters(filters)
function, I got this error from setFilters function: "undefined property is invalid".
此外,我没有在powerbi-client中找到以上文档中使用的功能:
Moreover, I didn't find the function used in the above docs in powerbi-client:
visualHost.applyJsonFilter(filter, "general", "filter", FilterAction.merge)
所以,我刚刚尝试过setFilters(filters)。
So, I just tried setFilters(filters).
深入了解过滤文档,我发现了这一点:
Getting deeper in the filters docs, I found this:
报告级过滤器支持以下类型:IBasicFilter |
IAdvancedFilter |
Report level filter supports the following types: IBasicFilter | IAdvancedFilter | IRelativeDateFilter.
页面级过滤器支持以下类型:IBasicFilter | IRelativeDateFilter。 IAdvancedFilter |
Page level filter supports the following types: IBasicFilter | IAdvancedFilter | IRelativeDateFilter.
可视级过滤器支持以下类型:IBasicFilter | IRelativeDateFilter。 IAdvancedFilter | IRelativeDateFilter | ITopNFilter | IIncludeExcludeFilter。
Visual level filter supports the following types: IBasicFilter | IAdvancedFilter | IRelativeDateFilter | ITopNFilter | IIncludeExcludeFilter.
所以,我不明白,如果上述过滤器级别均不支持,如何使用元组过滤器! / p>
So, what I couldn't understand, how to use Tuple Filters if none of the above filter levels support it!
推荐答案
不支持嵌入元组过滤器
您正确阅读,任何过滤器级别均不支持 TupleFilter 。它是 Power BI视觉-因此可用于创建自定义切片器(例如 HierarchySlicer -可能会解决您的问题。
但是,当前,Power BI过滤器根本不支持元组过滤器,因此不能与 powerbi客户端-用于在网页或应用程序中嵌入Power BI元素(报表,仪表板,可视化等)。
Tuple filter is not supported for embedding
You read correctly, TupleFilter is not supported in any filter level. It's an API used by Power BI visuals - so it can be used to create custom slicers (such as HierarchySlicer - it may solve your issue btw). Currently however, tuple filters aren't supported for Power BI filters at all, so can't be used with powerbi-client - which deals with embedding a Power BI "element" (report, dashboard, visual etc.) inside a web page or application.
请注意,将来可能会添加对powerbi-client的元组过滤器支持。
Note that tuple filter support for powerbi-client may be added in the future.
完整披露:I是一名Microsoft员工,曾在Power BI的一个开发团队中工作。与HierarchySlicer视觉没有关联。
Full disclosure: I'm a Microsoft employee, working in one of Power BI's development teams. No affiliation with HierarchySlicer visual.
这篇关于PowerBI:如何将TupleFilter与powerbi-client一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!