Forum Discussion

newpbiuser01's avatar
newpbiuser01
Helper V
4 years ago
Solved

Dynamically change matrix visual value

Hello,

I have created a matrix visual using the Fields parameters to allow a user to dynamically change the rows and columns in the table. I would typically drive the value field for the matrix with a measure that uses a the slicer value of metric options - spend, volume etc. However, it looks like I can't use a measure in this case. Does anyone know if its possible to toggle between multiple columns where the metrics are sometimes using the Sum and sometimes DistinctCount functions. 

I'd really appreciate any help!

  • If you are using the new field parameters you can use this to create a new measure that dynamically selects a measure or column

    xP_param1 = 
    SWITCH (
        SELECTEDVALUE ( xP_Param[xP_Param Order] ),
        0, [Measure1],
        1, [Measure2],
        2, [Measure3],
        3, [Measure4],
        4, [Measure5]
    )

     you can then use this in the values section to give you the right calculation for the selection 

    It uses the sort order column to link a measure to each parameter option.

3 Replies

  • newpbiuser01 , Not very clear, But I have used field parameters in values of matrix too. I created a field parameter using measures and use that in values

    • newpbiuser01's avatar
      newpbiuser01
      Helper V

      Hi amitchandak,

      I was under the impression that the field parameters would not work with explicit summarization - which I think is using a measure. I may be misunderstanding how to use these field parameters. 😞

      Thank you!

  • itchyeyeballs's avatar
    itchyeyeballs
    Impactful Individual

    If you are using the new field parameters you can use this to create a new measure that dynamically selects a measure or column

    xP_param1 = 
    SWITCH (
        SELECTEDVALUE ( xP_Param[xP_Param Order] ),
        0, [Measure1],
        1, [Measure2],
        2, [Measure3],
        3, [Measure4],
        4, [Measure5]
    )

     you can then use this in the values section to give you the right calculation for the selection 

    It uses the sort order column to link a measure to each parameter option.