Forum Discussion

JosephWu's avatar
JosephWu
Frequent Visitor
3 years ago
Solved

Slicer Setting limit the matrix?

Hi All, I have touched the power BI almost 1month,and it's really funny and stimulate creativity by the DAX and matrix combined.   Recently,I just meet a problem,and solved that by YT Video and ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  JosephWu ,

    I created some data:

    If your slicer and matrix are related, then you select 2022.1.1 – 2022.2.1 in the slicer, only the date filtered by the slicer will appear between the matrices, if you want to display the date not selected in the slicer according to your own custom rules, you still need to have a date column that is not related to the data in the matrix.

    After that, use the IF method to judge and put it in the filter to set.

    1. Create measure.

    Flag =
    var _selectyear=SELECTEDVALUE('Year_Slicer'[Year])
    var _selectqu=SELECTEDVALUE('Qu_Slicer'[Quarter])
    return
    IF(
    AND(
    YEAR(MAX('Table'[Date])) =_selectyear ,QUARTER(MAX('Table'[Date]))>=_selectqu-1&&QUARTER(MAX('Table'[Date]))<=_selectqu)
    ||
    AND(
            YEAR(MAX('Table'[Date])) =_selectyear -1 ,QUARTER(MAX('Table'[Date]))=_selectqu),1,0)

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly