Forum Discussion

BindiyaThota's avatar
BindiyaThota
Helper I
2 years ago
Solved

Display dynamic fields in table based on a slicer

Hi,

I have a slicer which has list of all measures. Based on the slection made in the slicer, it should display the corresponding measure in the table something like below. Note that my slicer is single select and is sourced from "measure_list" table.

Is this possbile using DAX?

Appreciate any suggestions. Thank you!

  • This should be. Check out the SELECTEDVALUE function, along with the SWITCH function. You can do it by creating a new Measure that will dynamically (read: SWITCH ) pick which measure to display based on the SELECTEDVALUE of your slicer. 

    A bit of air-ware: [My Measure to Display] = SWITCH ( SELECTEDVALUE ( <The Slicer Value>, [Measure 1], [Measure 2])

    I have done this before but don't have code ready to go.

    Good that your Slicer is Single Select only.

    Hope that helps.

5 Replies

    • BindiyaThota's avatar
      BindiyaThota
      Helper I

      Thank you for the suggestion. Works perfectly. The column name changes dynamically too and also works for multiselect slicer! 

  • This should be. Check out the SELECTEDVALUE function, along with the SWITCH function. You can do it by creating a new Measure that will dynamically (read: SWITCH ) pick which measure to display based on the SELECTEDVALUE of your slicer. 

    A bit of air-ware: [My Measure to Display] = SWITCH ( SELECTEDVALUE ( <The Slicer Value>, [Measure 1], [Measure 2])

    I have done this before but don't have code ready to go.

    Good that your Slicer is Single Select only.

    Hope that helps.

    • BindiyaThota's avatar
      BindiyaThota
      Helper I

      Thank you for the suggestion. I am able to solve it using SWITCH & SELECTEDVALUE. It is just that the field name is static and would love that also to dynamically change. Is there a way to do that too?

      • ToddChitt's avatar
        ToddChitt
        Super User

        I think you can do dynamic field naming for the visual, but don't hold me to it.