Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Is there a DAX that can help with toggling the visualization based on filtered options?

Hi, I have a dataset containing a few tables. One main table and two other tables where all three are connected using the id. 

Referring to the image from left to right, let's call them table 1, main table, and table 2 respectively. 

Let's say I have a filter as below

when I chose A and C, I want all tables to only show rows where the ID are 1,3, and 4. I want all tables to exclude id=2 because that only contains A and not both 'A and C' at the same time. How do I do this?

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

    You can create an unconnected table with all Value Items and use it as source of slicer.

    Then you can use following measure formula to compare with the current value and selection to return tag and use this formula on your visual level filter to filter records:

    formula =
    VAR selection =
        VALUES ( NewTable[Item] )
    VAR summary =
        SUMMARIZE (
            FILTER ( ALLSELECTED ( Table ), [Value] IN selection ),
            [ID],
            "DCount", DISTINCTCOUNT ( Table[Value] )
        )
    VAR currID =
        SELECTEDVALUE ( Table[ID] )
    RETURN
        IF (
            currID
                IN SELECTCOLUMNS ( FILTER ( summary, [DCount] = 2 ), "ID", [ID] ),
            "Y",
            "N"
        )

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    You can create an unconnected table with all Value Items and use it as source of slicer.

    Then you can use following measure formula to compare with the current value and selection to return tag and use this formula on your visual level filter to filter records:

    formula =
    VAR selection =
        VALUES ( NewTable[Item] )
    VAR summary =
        SUMMARIZE (
            FILTER ( ALLSELECTED ( Table ), [Value] IN selection ),
            [ID],
            "DCount", DISTINCTCOUNT ( Table[Value] )
        )
    VAR currID =
        SELECTEDVALUE ( Table[ID] )
    RETURN
        IF (
            currID
                IN SELECTCOLUMNS ( FILTER ( summary, [DCount] = 2 ), "ID", [ID] ),
            "Y",
            "N"
        )

    Regards,

    Xiaoxin Sheng