Forum Discussion
Anonymous
1 year agoNot applicable
Field Parameter composite key error?
I'm facing an issue in Power BI after creating a field parameter to swap between 4 hierarchy columns with person names in them. The user should be able to select hierarchy level in slicer, and then, ...
DataInsights
1 year agoSuper User
Anonymous,
To use SELECTEDVALUE with field parameters, adjust your DAX per the article below:
https://www.sqlbi.com/blog/marco/2022/06/11/using-selectedvalue-with-fields-parameters-in-power-bi/
Another option is to use MAX:
VAR selectedRole = MAX ( hierarchy_parameter_test[hierarchy_parameter_test] )
- Anonymous1 year agoNot applicable
Hi DataInsights - Thanks for sharing that resource article. Had a look, and maybe I am missing something, but Max will only return 1 value, rather than the entire list of values in the column. So when I pick a level, it returns just 1 name, instead of the entire list of values.
- DataInsights1 year agoSuper User
Anonymous,
Have you tried using the field parameter in the visual? The engine is able to dynamically use the selected field without the need for custom DAX. You can customize the names as shown below:
hierarchy_parameter_test = { ( "DIR", NAMEOF ( 'FIELD_PARAMETER'[DIRECTOR_NAME] ), 0 ), ( "MGR", NAMEOF ( 'FIELD_PARAMETER'[MANAGER_NAME] ), 1 ), ( "SUP", NAMEOF ( 'FIELD_PARAMETER'[SUPERVISOR_NAME] ), 2 ), ( "VP", NAMEOF ( 'FIELD_PARAMETER'[VP_NAME] ), 3 ) }