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
Anonymous
Not applicable

Dax Query to split the strings using delimiters and expand it in rows in a column measure

Hello I have a column as below

NameAccessories
ABags,Pencil
BBags, Bottle
CBottle , Pencil
DEraser, Mobile
ECharger,Mobile

It should display in the below form

NameAccessories
ABags
APencil
BBags
BBottle
CBottle
CPencil
DEraser
DMobile
ECharger
EMobile
1 ACCEPTED SOLUTION
Gayatri_D05
Resolver II
Resolver II

Hi @Anonymous ,
There are two ways I have tried this.
One is to make a linked table and then cross join it but the way with crossjoin could be potentially way bigger than the table you want to end up with, so heres an alternative that gives a table that's exactly the right size that you want to end up with.

Split = 
VAR ToPaths =
    ADDCOLUMNS (
        SELECTCOLUMNS (
            Table,
            "@ID", Table[Name],
            "@Path", SUBSTITUTE ( Table[Accessories], " ", "," )
        ),
        "@Length", PATHLENGTH ( [@Path] )
    )
VAR T =
    ADDCOLUMNS (
        ToPaths,
        "@Cumulative", SUMX ( FILTER ( ToPaths, [@ID] <= EARLIER ( [@ID] ) ), [@Length] )
    )
RETURN
    ADDCOLUMNS (
        SELECTCOLUMNS (
            ADDCOLUMNS (
                GENERATESERIES ( 1, SUMX ( T, [@Length] ) ),
                "Cumulative", MINX ( FILTER ( T, [@Cumulative] >= [Value] ), [@Cumulative] )
            ),
            "Name", MAXX ( FILTER ( T, [@Cumulative] = [Cumulative] ), [@ID] ),
            "Accessories", MAXX ( FILTER ( T, [@Cumulative] = [Cumulative] ), [@Path] ),
            "Accessories Number", 1 + [Cumulative] - [Value]
        ),
        "Accessories Split", PATHITEM ( [Accessories], [Name] )
    )


Just replace Table with your table name and the respective columns if you face any errors.

If your requirement is solved, please make THIS ANSWER as SOLUTION and help other users find the solution quickly. Please hit the LIKE button if this comment helps you.😊

View solution in original post

4 REPLIES 4
Gayatri_D05
Resolver II
Resolver II

Hi @Anonymous ,
There are two ways I have tried this.
One is to make a linked table and then cross join it but the way with crossjoin could be potentially way bigger than the table you want to end up with, so heres an alternative that gives a table that's exactly the right size that you want to end up with.

Split = 
VAR ToPaths =
    ADDCOLUMNS (
        SELECTCOLUMNS (
            Table,
            "@ID", Table[Name],
            "@Path", SUBSTITUTE ( Table[Accessories], " ", "," )
        ),
        "@Length", PATHLENGTH ( [@Path] )
    )
VAR T =
    ADDCOLUMNS (
        ToPaths,
        "@Cumulative", SUMX ( FILTER ( ToPaths, [@ID] <= EARLIER ( [@ID] ) ), [@Length] )
    )
RETURN
    ADDCOLUMNS (
        SELECTCOLUMNS (
            ADDCOLUMNS (
                GENERATESERIES ( 1, SUMX ( T, [@Length] ) ),
                "Cumulative", MINX ( FILTER ( T, [@Cumulative] >= [Value] ), [@Cumulative] )
            ),
            "Name", MAXX ( FILTER ( T, [@Cumulative] = [Cumulative] ), [@ID] ),
            "Accessories", MAXX ( FILTER ( T, [@Cumulative] = [Cumulative] ), [@Path] ),
            "Accessories Number", 1 + [Cumulative] - [Value]
        ),
        "Accessories Split", PATHITEM ( [Accessories], [Name] )
    )


Just replace Table with your table name and the respective columns if you face any errors.

If your requirement is solved, please make THIS ANSWER as SOLUTION and help other users find the solution quickly. Please hit the LIKE button if this comment helps you.😊

Analystmate
Helper II
Helper II

Hi sonalisaha2310,
This can be easily done using Power Query. Below is a screenshot showing how to accomplish it in Power Query.

Analystmate_0-1709631447757.gif

 





Anonymous
Not applicable

I am not getting the column in Power Query Editor as the column is a calculated column , therefore I needed a dax query for it  

Can you create the calculated column in Power Query and then use the delimiter to achieve the results ?

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.