Forum Discussion

pacificnwp's avatar
pacificnwp
Frequent Visitor
7 months ago
Solved

Dynamic Filter with Dynamic Measure Selection in Report Matrix

I have a solution that "works", but I don't think it's ideal and I don't fully understand why it works.   I have a matrix with names going down, and year-quarter going across.  I want the ability t...
  • DanieleUgoCopp's avatar
    7 months ago

    I think a better approach is to choose one pattern and stick with it, and calculation groups are probably the better option here.

    What you’re seeing now actually makes sense once the calculation group is in place, it applies its logic to whatever measure is in the matrix.
    That’s why the original dynamic SWITCH measures feel pointless  they’re effectively being bypassed, and that’s expected behavior.

    A simpler setup would be to keep very basic measures that do only one thing, for example:

    Base Revenue := SUM ( Sales[Revenue] )
    Base Attainment := DIVIDE ( SUM ( Sales[Actual] ), SUM ( Sales[Target] ) )

    Then let a calculation group handle the choice between Revenue and Attainment using SELECTEDMEASURE(), including the correct formatting for currency versus percent.
    In the matrix you only need one base measure, and the slicer on the calculation group choose what the user sees.

    I think this should be better mainly because it avoids duplicated logic and fixes the formatting issue in a more natural way, even though your current solution does technically work.