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! Learn more

Reply
msmays5
Helper II
Helper II

Combine Selected Values of Hierarchy Slicer

Hi everyone, I have a slicer that has 'Country Group Total'[Zone] with  'Country Group Total'[Country] nested underneath. I'm trying to create a measure that will return the values selected in the slicer.  If all countries within a zone(s) are selected, those zones will be concatenated together. If there is a zone that has some but not all countries selected, then those countries will be appended at the end.

 

As a shortened example:

Mexico, United States, and Canada are all countires in zone North America

Ireland, Scotland, Wales, and England are all countries in zone Great Britain

France, Germany, and Italy and are countries in zone Europe

 

If all countries in North America and Great Britain are selected, along with Germany, the result would be "North America, Great Britain, Germany"; if only Mexico and Germany are selected, the result would be "Mexico, Germany"

 

I was able to get it working with Zones but couldn't figure out a way to append the selected countries at the end. To be more specific, I'm having trouble solving for VAR _ConcatPartialZoneCountries. All help is greatly appreciated!

VAR _ZoneSelectedType =
    ADDCOLUMNS (
        SUMMARIZE ( 'Country Group Total', 'Country Group Total'[Zone] ),
        "@ZoneSelectionType",
            VAR _CountInZone =
                CALCULATE (
                    COUNTROWS ( 'Country Group Total' ),
                    ALLEXCEPT ( 'Country Group Total', 'Country Group Total'[Zone] )
                )
            VAR _CountSelected = CALCULATE ( COUNTROWS ( 'Country Group Total' ) )
            VAR _Switch =
                SWITCH (
                    TRUE (),
                    _CountInZone = _CountSelected, "All",
                    _CountSelected > 0, "Some",
                    "None"
                )
            RETURN
                _Switch
    )
VAR _AllSelected = FILTER ( _ZoneSelectedType, [@ZoneSelectionType] = "All" )
VAR _SomeSelected = FILTER ( _ZoneSelectedType, [@ZoneSelectionType] = "Some" )
VAR _ConcatAllZones = CONCATENATEX ( _AllSelected, 'Country Group Total'[Zone], ", " )
VAR _ConcatPartialZoneCountries = "List of Countries"
VAR _Combine = _ConcatAllZones & ", " & _ConcatPartialZoneCountries 

 

 

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

You could CONCATENATEX the countries, filtering by _SomeSelected Zones:

 

VAR _ConcatPartialZoneCountries =
CALCULATE(
CONCATENATEX(VALUES('Country Group Total'[Country]), 'Country Group Total'[Country], ", ") ,
_SomeSelected
)

View solution in original post

2 REPLIES 2
PaulOlding
Solution Sage
Solution Sage

You could CONCATENATEX the countries, filtering by _SomeSelected Zones:

 

VAR _ConcatPartialZoneCountries =
CALCULATE(
CONCATENATEX(VALUES('Country Group Total'[Country]), 'Country Group Total'[Country], ", ") ,
_SomeSelected
)

@PaulOlding That was perfect, thank you so much for taking the time to help!

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.