Forum Discussion

TomWoodward's avatar
TomWoodward
Frequent Visitor
3 years ago
Solved

Using Slicer Selection to Filter large table with multiple values in a column

I have a table of Purchase Orders. One column in this table is listing specifier information and may contain anything like the below, which is a list of architects and engineers assigned to each orde...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi TomWoodward ,

    I created a sample pbix file(see the attachment), please find the details in it.

    1. Create a measure as below

    Flag = 
    VAR _userids =
        ALLSELECTED ( 'Users'[USERID] )
    VAR _specifiers =
        CALCULATETABLE (
            VALUES ( 'Specifiers'[SPECIFIER] ),
            FILTER ( 'Specifiers', 'Specifiers'[USERID] IN _userids )
        )
    VAR _specifier =
        MAX ( 'PO'[Specifier] )
    VAR _spec1 =
        SUBSTITUTE ( _specifier, "ARCHITECT: ", "" )
    VAR _spec2 =
        SUBSTITUTE ( _spec1, "ENGINEER: ", "" )
    VAR mymeasure =
        SUBSTITUTE ( _spec2, ", ", "|" )
    VAR Mylen =
        PATHLENGTH ( mymeasure )
    VAR mytable =
        ADDCOLUMNS (
            GENERATESERIES ( 1, mylen ),
            "mylist", PATHITEM ( mymeasure, [Value] )
        )
    VAR _specifiers2 =
        SELECTCOLUMNS ( mytable, "list", [mylist] )
    VAR _count =
        COUNTROWS ( INTERSECT ( _specifiers, _specifiers2 ) )
    RETURN
        IF ( _count > 0, 1, 0 )

    2. Create a visual and apply a visual-level filter with the condition(Flag is 1)

    Best Regards