Forum Discussion

FunWithPowerBI's avatar
FunWithPowerBI
Regular Visitor
6 years ago
Solved

Filter the matrix by slicer

Based on the slicer 2 value take the date and filter the matrix     
  • MFelix's avatar
    6 years ago

    Hi FunWithPowerBI ,

     

    Create to unrelated tables for the slicer 1 and slicer 2 then add the following measure:

    Filter_By_Slicers =
    VAR Star_date =
        MIN ( 'Dates Slicer'[Date] )
    VAR end_date =
        MAX ( 'Dates Slicer'[Date] )
    VAR Slicer_2 =
        SELECTEDVALUE ( 'Slicer 2'[ID] )
    RETURN
        SWITCH (
            TRUE ();
            Slicer_2 = 1
                && SELECTEDVALUE ( Data[Date] ) >= Star_date
                && SELECTEDVALUE ( Data[Date] ) <= end_date; 1;
            Slicer_2 = 2
                && SELECTEDVALUE ( Data[Status] ) = "Active"
                && SELECTEDVALUE ( Data[Date] ) <= end_date; 1;
            Slicer_2 = 3
                && SELECTEDVALUE ( Data[Status] ) = "Active"
                && SELECTEDVALUE ( Data[Date] ) <= Star_date; 1;
            BLANK ()
        )

    Now filter you visualizations by all values that are not blank.

     

    Check PBIX file attach.