Forum Discussion

Randomlee's avatar
Randomlee
New Member
11 months ago
Solved

understanding filter context on Matrix visual

I have a measure which can be seen as the values in the matrix below. I have applied a greater than 4 filter on the visual using the same measure. The filter appears to work on all visuals (I've test...
  • rohit1991's avatar
    11 months ago

    Hi Randomlee 

    When you apply a measure filter like greater than 4 on a Matrix, it behaves differently than in a Table or Card. The Matrix first evaluates the measure at the group/parent level, and if that group total passes the filter, all its child rows are still displayed  even if some of them are below the threshold. That’s why you still see values < 4 inside the Matrix.

     

    To hide those detail rows properly, you need to blank them out with DAX logic. A working pattern is:

    Total Value =
    SUM ( Fact[Value] )
    Row Visible ( > 4 ) =
    VAR _th = 4
    RETURN
    IF (
       ISINSCOPE ( Fact[Subgroup] ),
           IF ( [Total Value] > _th, 1, 0 ),
           IF (
               CALCULATE (
                  COUNTROWS (
                      FILTER (
                          VALUES ( Fact[Subgroup] ),
                          CALCULATE ( [Total Value] ) > _th
                       )
                   )
               ) > 0, 1, 0
           )
    )
    Display Value ( > 4 only ) =
    VAR _th = 4
    RETURN
    IF (
       ISINSCOPE ( Fact[Subgroup] ) && [Total Value] <= _th,
       BLANK (),
       [Total Value]
    )

     

    Then build your Matrix like this:

    • Rows: AgeGroup >> Subgroup
    • Values: Display Value ( > 4 only )
    • Visual filter: Row Visible ( > 4 ) = 1

    Make sure Show items with no data is turned Off.

     

  • Shahid12523's avatar
    11 months ago

    The Matrix visual keeps showing values less than 4 because the filter applies after the visual builds its rows and columns. To hide those smaller values, rewrite your measure like this:
    MeasureFiltered = IF([YourMeasure] > 4, [YourMeasure], BLANK())


    This blanks out values ≤4, making the Matrix omit or hide them properly.