Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
elidman
Frequent Visitor

Get slicer selected member keys as measure

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;

VAR Company = IF(ISFILTERED(DimCompany[CompanyKey]) ,
                "CompanyKey = " & CONCATENATEX(ALLSELECTED(DimCompany[CompanyKey]) , DimCompany[CompanyKey] , " , ") & CR_LF , "")

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;

Selected filters = if(HASONEFILTER(DimCompany[CompanyName]), Values(DimCompany[CompanyKey]))
This is exactly what I want to do, except I want the user to be able to do multi-select in the slicer, which HASONEFILTER do not support.
 
Any help would be appriciated,
 
/Erik
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @elidman ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1670564058337.png

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

Animation24.gif

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.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @elidman ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1670564058337.png

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

Animation24.gif

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.

amitchandak
Super User
Super User

@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 , "")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors