隐藏视觉对象,直到在 Power BI 中选择切片器

时间:2021-01-20 06:43:17

标签: powerbi dax

我想仅在选择了 3 个切片器时才在表格视觉对象上显示值,否则不应显示任何值。为此,我做到了:

IF(ISFILTERED(Table[Country]),IF(ISFILTERED(Table[Procurement Team]),IF(ISFILTERED(Table[Class]),1,0),0),0)

然后在“过滤器”面板中,我放置了此度量并执行了 "is" 1. This means when the slicers are selected, i.e. TRUE then the values will be showed however this is working fine till procurement team selection but as soon as I am selecting class , the values in the table get populated.我不明白为什么。有人能帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我认为问题在于您正在使用视觉对象中的某些字段。删除视觉创建的过滤器上下文可能是一个可能的解决方案。为此,请使用 ALLSELECTEDCALCULATE

ToShow =
CALCULATE(
    IF(
        ISFILTERED( 'Table'[Country] ),
        IF(
            ISFILTERED( 'Table'[Procurement Team] ),
            IF( ISFILTERED( 'Table'[Class] ), 1, 0 ),
            0
        ),
        0
    ),
    ALLSELECTED( 'Table' )
)

然后您可以实施测试 [ToShow] 的措施,例如

Sum Value =
IF( [ToShow] = 1, SUM( 'Table'[Value] ) )