Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I'm would like to generate a concatenated string of selected members (keys) from a slicer as a measure text string.
The end-user pick a few companies (CompanyName) in a slicer and I want the measure to return a string of CompanyKeys of the selected companies.
I have tried this;
It works great, if the slicer show the surugat key "CompanyKey". But the user do not understand what the number 12344321 means... We need to use the CompanyName in the slicer.
And I have tried this;
Solved! Go to Solution.
Hi @elidman ,
Please try below steps:
1. below is my test table
Table:
2. create a measure with below dax formula
Measure =
VAR _str =
CONCATENATEX ( 'Table', [Company Name], "," )
VAR tmp =
CALCULATETABLE (
VALUES ( 'Table'[Company Key] ),
CONTAINSSTRING ( _str, 'Table'[Company Name] )
)
RETURN
IF (
ISFILTERED ( 'Table'[Company Name] ),
CONCATENATEX ( tmp, [Company Key], "
" )
)
3. add a sclicer with "Table[Company Name]", add a card visual with measure
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @elidman ,
Please try below steps:
1. below is my test table
Table:
2. create a measure with below dax formula
Measure =
VAR _str =
CONCATENATEX ( 'Table', [Company Name], "," )
VAR tmp =
CALCULATETABLE (
VALUES ( 'Table'[Company Key] ),
CONTAINSSTRING ( _str, 'Table'[Company Name] )
)
RETURN
IF (
ISFILTERED ( 'Table'[Company Name] ),
CONCATENATEX ( tmp, [Company Key], "
" )
)
3. add a sclicer with "Table[Company Name]", add a card visual with measure
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@elidman , not very clear, but if you have company name column too
VAR Company = IF(ISFILTERED(DimCompany[CompanyKey]) ,
"CompanyKey = " & CONCATENATEX(DimCompany, DimCompany[CompanyKey] & " - " & DimCompany[CompanyName] , " , ") & CR_LF , "")
User | Count |
---|---|
103 | |
90 | |
78 | |
72 | |
68 |
User | Count |
---|---|
108 | |
96 | |
95 | |
74 | |
71 |