基于另一个切片器选择的Power BI切片器的初始值 [英] Initial value of Power BI slicer based on another slicer choice
问题描述
每当上层切片器的值发生变化时,我都想设置下层切片器的初始值.假设我们有以下数据:
I would like to set up initial value of lower category slicer whenever upper category slicer value changes. Suppose we have this data:
+----------------+----------------+-------+
| upper category | lower category | units |
+----------------+----------------+-------+
| fruit | apple | 1 |
| fruit | banana | 1 |
| vegetable | carrot | 1 |
| vegetable | potato | 1 |
+----------------+----------------+-------+
我们在报告中添加了两个切片器视觉效果.看起来像这样:
We add two slicer visuals to the report. It looks like this:
我想要的结果是:每当用户从上层类别中选择 fruit
时,就会从下层类别切片器中选择 apple
.因此,我们最终得到以下结果:
My desired results are this: Whenever the user selects fruit
from upper category, then apple
is selected from lower category slicer. So we end up with this:
现在,我们在较高类别的切片器中单击 vegetable
,然后自动将 carrot
选择为较低类别的切片器的初始过滤器值.因此,我们最终得到以下结果:
Now the we click on vegetable
in upper category slicer, and automatically carrot
is selected as an initial filter value of lower category slicer. So we end up with this:
摘要:
- 上部类别切片器显示所有项目,而与下部类别切片器的选择无关.
- 较低类别的切片器根据较高类别的切片器的选择仅显示适用的项目.
- 从较高类别的切片器中选择项目之后,始终选择较低类别的切片器的一个初始可应用值.
在谷歌搜索后,我发现这是解决方案的有希望的线索: https://www.kasperonbi.com/embed-您的电源双向报告带有预定义的过滤器/
After googling I have found this as a promising clue to the solution: https://www.kasperonbi.com/embed-your-power-bi-report-with-predefined-filters/
我不必坚持使用切片机的视觉效果.可能是另外一回事.我要保持此功能.我可以想象可以用R visual通过此处表达的概念来实现:
I do not have to stick to slicer visual. It could be something else. What I want is to maintain this functionality. I could imagine that it could be accomplished with R visual by the concept expressed here: https://dataveld.com/2016/02/10/r-visuals-in-power-bi-beyond-plots/
为方便起见,以下是一个起始表代码:
Here is a start table code for your convenience:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSisqzSxR0lFKLCjISQXShkqxOgjRpMQ8IIQLl6Wmp5YkJoEVJicWFeWXYJUqyC9JLMmHSMUCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"upper category" = _t, #"lower category" = _t, units = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"upper category", type text}, {"lower category", type text}, {"units", Int64.Type}})
in
#"Changed Type"
推荐答案
我不认为当前无法使用默认切片器实现,因为无法以编程方式设置切片器选择,但是
I don't believe this is currently possible with the default slicer as there is no way to programmatically set a slicer selection, but this related idea is a popular request that is currently "under review".
这篇关于基于另一个切片器选择的Power BI切片器的初始值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!