Forum Discussion

PaulKraemer's avatar
PaulKraemer
Advocate II
1 year ago
Solved

Matrix Visualization with multiple grouping levels - applying a filter to just one level?

Hi,   I have created a Matrix Visualization that looks like the image below....        The Data Source is a table that has three fields that I use for grouping and summarization - TenantT...
  • danextian's avatar
    danextian
    1 year ago

    Hi PaulKraemer 

     

    You'll need to compute the percentage difference at both the stock_num and tik_num level.

    Difference - stock_num = 
    VAR _scanned =
        SUM ( ScannedVsExpected[total_footage_scanned] )
    VAR _qty =
        SUM ( ScannedVsExpected[est_footage_qty_adjust] )
    VAR _diff = _scanned - _qty
    RETURN
        DIVIDE ( _diff, _qty )
    
    Difference - tik_num = 
    VAR _scanned =
        CALCULATE (
            SUM ( ScannedVsExpected[total_footage_scanned] ),
            ALLEXCEPT ( ScannedVsExpected, ScannedVsExpected[tik_num] )
        )
    VAR _qty =
        CALCULATE (
            SUM ( ScannedVsExpected[est_footage_qty_adjust] ),
            ALLEXCEPT ( ScannedVsExpected, ScannedVsExpected[tik_num] )
        )
    VAR _diff = _scanned - _qty
    RETURN
        DIVIDE ( _diff, _qty )
    

    Then write measures as visual filter based on the result of the above measures

    Filter - stock_num = 
    IF ( ABS ( [Difference - stock_num] ) <= 0.1, 1, 0 )
    
    Filter - tik_num = 
    IF ( ABS ( [Difference - tik_num] ) <= 0.1, 1, 0 )
    

     

    Create a placeholder table/disconnected table to be able to switch between these two filter measures

    Final Filter = 
    VAR _comparison =
        SELECTEDVALUE ( ComparisonOption[Sort] )
    VAR _both = [Filter - tik_num] = 1
        || [Filter - stock_num] = 1
    RETURN
        SWITCH (
            TRUE (),
            _comparison = 1, [Filter - stock_num],
            _comparison = 2, [Filter - tik_num],
            _both, 1
        )
    

    The  percentages and the filter measuers don't need to be in the visual. They're there to easily visualize the results.

    Pelase see the attached sample pbix.