问题描述
我有一个群集的柱状图,并且在图例字段中必须基于切片器在2列之间切换:
I have a Clustered column chart and for the Legend field and have to switch between 2 columns based on a slicer:
- 如果没有如果对切片器进行了过滤,然后将column0用于Legend
- 如果对切片器进行了过滤,则将column1用于Legend
我尝试添加这样的计算列
I tried adding a calculated column like this
Column = IF(ISFILTERED(Table1[slicer]) = TRUE(), Table1[column1], Table1[column0])
然后将此列用作图例。
但这是行不通的!
您能告诉我正确的做法吗?
Can you please advice me how to do it right?
推荐答案
无法通过切片器过滤计算出的列。
You can't filter calculated columns by slicers.
计算出的列仅计算一次-加载/刷新数据模型时。此后,它们包含无法响应切片器的固定静态值。
Calculated columns are only calculated once - when you load/refresh your data model. After that, they contain fixed, static values that can not respond to slicers.
要实现目标,您将需要使用度量而非计算列来重新设计图表。然后您的公式将如下所示:
To achieve your goal, you will need to redesign your chart using measures, not calculated columns. Then your formula will look like this:
[Measure to Chart] = IF(ISFILTERED(Table1[slicer]), [Measure 1], [Measure 2])
如果您需要更多帮助,建议您发布另一个问题以及有关您的数据模型和预期结果的更多信息。
If you want more help, I would recommend to post another question with more information about your data model and desired outcome.
这篇关于切片机的功率双过滤器柱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!