Forum Discussion
How to create a label field based on selected fields
I would like the matrix on the right hand side of the page to always show a single row and be dynamically based on the selection in the left hand table e.g. to show Overall or Australia or Australia - Large Customer or Australia - Large Customer - Alonso, Danny according to the selection. What DAX formula would I need to use to do this please?
How about something like this?
My test data
Result. I used a normal table on the right.
It's not perfect ie. if selecting a "country" with a single item in it. If I select "a" it will show "x". But maybe this would work for you?
pbiGive this a try.
Label = VAR _Country = SELECTEDVALUE('Customer'[Country]) VAR _Category = SELECTEDVALUE('Customer'[Category]) VAR _Name = SELECTEDVALUE('Customer'[Name]) RETURN COMBINEVALUES(" ",_Country,_Category,_Name)
4 Replies
- jdbuchanan71
Super User
Give this a try.
Label = VAR _Country = SELECTEDVALUE('Customer'[Country]) VAR _Category = SELECTEDVALUE('Customer'[Category]) VAR _Name = SELECTEDVALUE('Customer'[Name]) RETURN COMBINEVALUES(" ",_Country,_Category,_Name)- bobby27Frequent Visitor
Thanks JD, this is a great solution, you've saved me hours of frustration.
- Gabriel_Walkman
Continued Contributor
How about something like this?
My test data
Result. I used a normal table on the right.
It's not perfect ie. if selecting a "country" with a single item in it. If I select "a" it will show "x". But maybe this would work for you?
pbi- bobby27Frequent Visitor
Thanks Gabriel, this works very well for me.