Forum Discussion

mp390988's avatar
mp390988
Post Partisan
1 year ago
Solved

How to filter values in matrix visual

Hi,   I have the below visual and I want to filter it to show those % attendance above or equal to 30%.       I tried implementing a visual filter as follows:       But the visu...
  • OwenAuger's avatar
    1 year ago

    Hi mp390988 

    Visual-level filters based on a measure in a Matrix visual are unfortunately pretty unintuitive.

    They work by:

    1. Evaluating the "total" value of the measure for each row of the matrix (not for each cell!), even if totals are not displayed per row.
    2. Based on these total values, filter the rows of the matrix according to the filter condition.

    A safer way to get the result you want would be to create a secondary measure, and use it in the visual instead:

    % attendance at least 30% =
    VAR Threshold = 0.3
    VAR PercentAttendance = [% attendance]
    VAR Result =
        IF ( PercentAttendance >= Threshold, PercentAttendance )
    RETURN
        Result

    This will blank out any values (at the cell level) that are below the 30% threshold.

     

    A side effect is that any rows/columns that are entirely blank as a result will be hidden. You can enable "Show items with no data" if you would like to display blank rows/columns.

     

    Does this work as expected?