Forum Discussion
Matrix Visualization with multiple grouping levels - applying a filter to just one level?
- 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.
Thank you danextian ! That works great !!
To take this one step further, rather than hard-coding the filter for +/- 10%, is there any way that I could use a user adjustable variable for this percentage? For example, can I change the following measure ...
Filter - tik_num = IF ( ABS ( [Difference - tik_num] ) <= 0.1, 1, 0 )
...... to something like ...
Filter - tik_num = IF ( ABS ( [Difference - tik_num] ) <= MyVariable, 1, 0 )
... and then provide an entry field that allows the user to change the value in MyVariable?
I really appreciate your help!
Thanks again and best regards,
Paul