Forum Discussion
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!
Hey BindiyaThota ,
the feature Field Parameters is what you are looking for: https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
Hopefully, this helps to tackle your challenge.
Regards,
Tom
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
- TomMartensSuper User
Hey BindiyaThota ,
the feature Field Parameters is what you are looking for: https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
Hopefully, this helps to tackle your challenge.
Regards,
Tom
- BindiyaThotaHelper I
Thank you for the suggestion. Works perfectly. The column name changes dynamically too and also works for multiselect slicer!
- ToddChittSuper User
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.
- BindiyaThotaHelper 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?
- ToddChittSuper User
I think you can do dynamic field naming for the visual, but don't hold me to it.