每当上类别切片器值发生变化时,我想设置下类别切片器的初始值。假设我们有这样的数据:
+----------------+----------------+-------+
| 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:
![enter image description here](https://i.stack.imgur.com/BkQai.png)
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:
![enter image description here](https://i.stack.imgur.com/fGkE8.png)
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:
![enter image description here](https://i.stack.imgur.com/n4zGc.png)
Summary:
- 上部类别切片器显示所有项目,无论下部类别切片器选择如何。
- 较低类别切片器根据较高类别切片器选择仅显示适用的项目。
- 从上类别切片器中选择项目后,总是选择下类别切片器的一个初始适用值。
经过谷歌搜索后,我发现这是解决方案的一个有希望的线索:https://www.kasperonbi.com/embed-your-power-bi-report-with-predefined-filters/
我不必坚持切片视觉。可能是别的东西。我想要的是保持这个功能。我可以想象它可以通过 R Visual 来完成,这里表达的概念是:https://dataveld.com/2016/02/10/r-visuals-in-power-bi-beyond-plots/
为了您的方便,这里是一个起始表代码:
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"