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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
gemcityzach
Helper IV
Helper IV

Summarizing concatenated values in a field

Hey folks,

 

I'm trying to figure out if there is an easy way to summarize concatenated values in a field, without having to split the fields into rows. But if that's the only way, then can you offer some suggestions for how to manage the fact that I have multiple fields that I'd like to perform these kinds of calculations on? Essentially, I have work units that can be assigned to multiple groups (1:n). I.e., one work unit could be assigned to up to 10 groups. I'd like to be able to show count data on how many units are being worked on. This same theme I'd like to be able to report on other concanenated fields.

 

To date what I've been doing is created a refeference of my Main query and then splitting the column to add new rows by Group. This allows me to get counts by Group. But for each Feature I want to create unique counts on, I have to generate another reference query to split on that Feature. Essentially, I'm trying to not have to create duplicate rows for every concatenation.

 

IDGroupTag1ProductCreated
RD-2024-00001Group1;Group2;Group3Blue;Red;GreenGuitar04/04/2024
RD-2024-00002Group4;Group3;Group1Orange;Green;RedStompbox04/04/2024
RD-2024-00003Group2;Group3;Group5Purple;Red;Green;BlueStrings04/04/2024

 

Is there a way to get summarized values by Group of the form, without having to split the field into rows?

 

GroupCount_of_ID
Group12
Group22
Group32
Group41
Group51

 

GroupRed
Group13
Group22
Group33
Group41
Group51
6 REPLIES 6
gemcityzach
Helper IV
Helper IV

Hi Xiaoxin, thanks for this! It's really interesting and I'm working on how to integrate it. What I can't figure out is whether or not it's possible to get the aggregations of Tags by Group? Like in my  second table.

 

The Tags calculated table is currently returning a List, which is the same as the original data source. So the measure is only returning a total count of tags.

Anonymous
Not applicable

HI @gemcityzach,

You can add two measure formulas to get the aggregated tag count based on current group, here are the formulas:

TagCount By Group = 
VAR currGroup =
    SELECTEDVALUE ( DimGroup[Group] )
VAR TagList =
    CALCULATE (
        CONCATENATEX ( VALUES ( T1[Tag1] ), [Tag1], ";" ),
        FILTER ( ALLSELECTED ( T1 ), SEARCH ( currGroup, [Group],, 0 ) > 0 )
    )
RETURN
    PATHLENGTH ( SUBSTITUTE ( TagList, ";", "|" ) )

Distinct TagCount By Group = 
VAR currGroup =
    SELECTEDVALUE ( DimGroup[Group] )
VAR tagPath =
    CALCULATE (
        SUBSTITUTE ( CONCATENATEX ( VALUES ( T1[Tag1] ), [Tag1], ";" ), ";", "|" ),
        FILTER ( ALLSELECTED ( T1 ), SEARCH ( currGroup, [Group],, 0 ) > 0 )
    )
VAR _pathtable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, PATHLENGTH ( tagPath ), 1 ),
        "Tag", PATHITEM ( tagPath, [Value] )
    )
RETURN
    COUNTROWS ( DISTINCT ( SELECTCOLUMNS ( _pathtable, "Tag", [Tag] ) ) )

1.png

Regards,

Xiaoxin Sheng

Thanks for your help. What I meant is that I should be able to summarize in some way, each tag by each group. I want to be able to show total observations by Group and also Tag Observations by Group.

 

Tag Observations by Group

GroupTagCount
Group1Red1
Group1Blue3
Group1Green15
Group2Black56
Group2Red2
Group2Blue6
Group3etcetc
etcetcetc

 

Total Observations by Group

GroupCount
Group119
Group264
Group3etc
Greg_Deckler
Community Champion
Community Champion

@gemcityzach If you have your groups in a separate disconnected table, maybe:

Measure Count of ID = 
  VAR __Group = MAX('Groups'[Group])
  VAR __Table = DISTINCT( SELECTCOLUMNS( FILTER( 'Table', FIND( __Group, [Group],, -1) <> -1 ) ) ), "__ID", [ID] )
  VAR __Result = COUNTROWS( __Table )
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I think I could create a table in the data model using the Group Names. Like a Reference Table that drops everything except Group Name and then removes all duplicates. You think I could reference to that?

Anonymous
Not applicable

Hi @gemcityzach,

Here are Dax expressions about extract and expand the raw table field value to create new calculated tables and measure expressions.
Then you can use these field to create table visual and measure expression to calculate the count based on current field value.

calculated tables:

DimGroup = 
VAR _path =
    SUBSTITUTE ( CONCATENATEX ( VALUES ( 'T1'[Group] ), [Group], ";" ), ";", "|" )
VAR _length =
    PATHLENGTH ( _path )
VAR _pathtable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, _length, 1 ),
        "Group", PATHITEM ( _path, [Value] )
    )
RETURN
    DISTINCT ( SELECTCOLUMNS ( _pathtable, "Group", [Group] ) )

DimTag = 
VAR _path =
    SUBSTITUTE ( CONCATENATEX ( VALUES ( 'T1'[Tag1] ), [Tag1], ";" ), ";", "|" )
VAR _length =
    PATHLENGTH ( _path )
VAR _pathtable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, _length, 1 ),
        "Tag", PATHITEM ( _path, [Value] )
    )
RETURN
    DISTINCT ( SELECTCOLUMNS ( _pathtable, "Tag", [Tag] ) )

Measures:

GroupCount = 
VAR currGroup =
    SELECTEDVALUE ( DimGroup[Group] )
RETURN
    COUNTROWS (
        FILTER ( ALLSELECTED ( T1 ), SEARCH ( currGroup, [Group],, 0 ) > 0 )
    )

TagCount = 
VAR currTag =
    SELECTEDVALUE ( DimTag[Tag] )
RETURN
    COUNTROWS ( FILTER ( ALLSELECTED ( T1 ), SEARCH ( currTag, [Tag1],, 0 ) > 0 ) )

2.png
Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.