Forum Discussion

pontushaglund's avatar
8 years ago
Solved

Iterate through filter values

Hi all. I'm trying to create a measure to filter a table based on two multi-select slicers that exist on the page (without relationships to the table or each other). The case is simple:  Slicer 1:...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hi,
    I would probably first declare a variable that is a table of all valid birth years for the combination of slicers.
    Then I would see if the birth year for the currently displayed person (for example in a table visual) exists in the list of valid years.

     

    Example measure could be something like this:

     

    Show =
    VAR Validyears =
        SELECTCOLUMNS (
            ADDCOLUMNS (
                CROSSJOIN ( VALUES ( SelectAge[Age] )VALUES ( Years[Years] ) );
                "ValidYear"; [Years] - [Age]
            );
            "ValidYear"; [ValidYear]
        )
    RETURN
        IF (
            COUNTROWS ( INTERSECT ( VALUES ( Person[Birthyear] ); Validyears ) ) > 0;
            1;
            BLANK ()
        )

     

    Br,

    Magnus