Forum Discussion
How to Dynamically Set Field Parameter Title Based on a Slicer in DAX?
- 1 year ago
Hello, Jskdlai23
you can't use SELECTEDVALUE for Field Parameter in its pure form.There's a quick workaround tho:
Field parameter as it is:Create new calculated column inside the field parameter table like this, basically referencing the first column
Then use SELECTEDVALUE for newly created column that mirrors the original one.
Can you share an example of how you continuen with the selectedvaule for the new created column?
I have 2 slicers in my report "Month" and "Year" and I want the measure to display YTD January 2025, YTD January 2024, YTD January 2023.... I am not quite sure how to continue, once I added the new calculated column within the field parameter.
Thank you!
- Element1151 year ago
Memorable Member
Perhaps this might help:
So, the Display slicer shows just a name. Depending on what the slicer selection is, this is returned by the SELECTEDVALUE() function inside a measure defined on the FieldSelector table. The SWITCH() function simply decides which measure is called depending on the incoming name chosen in the slicer, like so:
show_selected_field = SWITCH ( SELECTEDVALUE ( 'FieldSelector'[MeasureName] ), "Velocity", 'TS_MEASURES'[TS_AVG_VELOCITYxHOUR], "Volume", 'TS_MEASURES'[TS_AVG_VOLxHOUR] )'TS_MEASURES' is just a dummy table that contains all my measures. Measures have global scope within a report. In other words, if you define a measure on table T0, this measure is visible from any other table. So, if one have a huge amount of tables and does not remember which measure is associated with with table, it is easier to find all measures if they are all centralized under one dummy table.