如何删除切片器中空白子级别的可视化

问题描述 投票:0回答:2

我想知道Power BI中是否有一种方法可以排除切片器中每个子级别的可视化,您可以在图片右侧看到。我只是有兴趣删除空白子级别,即使在右边表格的相应列中该列是空的。有什么办法可以做到这一点吗?

enter image description here

谢谢

powerbi dax visualization powerbi-desktop measure
2个回答
2
投票

这被称为参差不齐的层次结构。要解决此问题,您可以使用支持不规则层次结构的自定义切片器(例如 https://xviz.com/blogs/ten-reasons-to-use-hierarchy-filter-slicer-power-bi-dashboard/)或实施一些非常复杂的 DAX 来抑制它们:https://www.daxpatterns.com/parent-child-hierarchies/


0
投票

检查隐藏层次矩阵中的空白值

其中的技巧是检查您所在的级别,然后与节点的当前级别进行比较,以便您可以使用以下内容进行过滤:

VAR EntityShowRow =
    [VV3BrowseDepth] <= [VV2RowDepth]
VAR Result =
    IF ( EntityShowRow, ...

步骤:

1.

VV1Depth = (VV[Ebene] <> BLANK())+1 + (VV[Ebene_1] <> BLANK()) + (VV[Ebene_2] <> BLANK()) + (VV[Ebene_3] <> BLANK()) + (VV[Ebene_4]  <> BLANK()) + (VV[Ebene_5] <> BLANK()) + (VV[Ebene_6] <> BLANK()) + (VV[Ebene_7] <> BLANK()) + (VV[Ebene_8] <> BLANK()) + (VV[Ebene_9] <> BLANK())
VV2RowDepth =
MAX ( VV[VV1Depth] )
VV3BrowseDepth =
    ISINSCOPE ( VV[Anzahl_Kinder] )
    + ISINSCOPE ( VV[Anzahl_Kinder_1] )
    + ISINSCOPE ( VV[Anzahl_Kinder_2] )
    + ISINSCOPE ( VV[Anzahl_Kinder_3] )
    + ISINSCOPE ( VV[Anzahl_Kinder_4] )
    + ISINSCOPE ( VV[Anzahl_Kinder_5] )
    + ISINSCOPE ( VV[Anzahl_Kinder_6] )
    + ISINSCOPE ( VV[Anzahl_Kinder_7] )
    + ISINSCOPE ( VV[Anzahl_Kinder_8] )
    + ISINSCOPE ( VV[Anzahl_Kinder_9] )

该示例允许每个级别有两个节点,名称节点的值位于矩阵的右侧,而子节点的数量不显示值。

MyTblNumberOfChildren =
VAR CurrentNode =
    SELECTEDVALUE(MyTbl[Name]) // This should pick the current node in the context
VAR AssociatedChildrenCount =
    CALCULATE(
        COUNTROWS(MyTbl),
        FILTER(MyTbl, MyTbl[Name] = CurrentNode)
    )
VAR EntityShowRow =
    [MyTbl3BrowseDepth] <= [MyTbl2RowDepth]
VAR Result =
    IF ( EntityShowRow, IF ( ISINSCOPE(MyTbl[Name]) && SELECTEDVALUE(MyTbl[Name]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children]) && NOT(ISINSCOPE(MyTbl[Name_1])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_1]) && SELECTEDVALUE(MyTbl[Name_1]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_1]) && NOT(ISINSCOPE(MyTbl[Name_2])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_2]) && SELECTEDVALUE(MyTbl[Name_2]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_2]) && NOT(ISINSCOPE(MyTbl[Name_3])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_3]) && SELECTEDVALUE(MyTbl[Name_3]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_3]) && NOT(ISINSCOPE(MyTbl[Name_4])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_4]) && SELECTEDVALUE(MyTbl[Name_4]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_4]) && NOT(ISINSCOPE(MyTbl[Name_5])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_5]) && SELECTEDVALUE(MyTbl[Name_5]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_5]) && NOT(ISINSCOPE(MyTbl[Name_6])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_6]) && SELECTEDVALUE(MyTbl[Name_6]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_6]) && NOT(ISINSCOPE(MyTbl[Name_7])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_7]) && SELECTEDVALUE(MyTbl[Name_7]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_7]) && NOT(ISINSCOPE(MyTbl[Name_8])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_8]) && SELECTEDVALUE(MyTbl[Name_8]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_8]) && NOT(ISINSCOPE(MyTbl[Name_9])), BLANK(), IF ( ISINSCOPE(MyTbl[Name_9]) && SELECTEDVALUE(MyTbl[Name_9]) = BLANK() || ISINSCOPE(MyTbl[Number_of_children_9]), BLANK(), AssociatedChildrenCount )))))))))))
RETURN
    Result
© www.soinside.com 2019 - 2024. All rights reserved.