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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Split Text into rows using DAX

Hi @power BI expert,

 

I need to split into rows using DAX instead of using Power Query due to performance (the data is too large). For info, previously i was using Power Query but I'm keep getting error messages saying about performance.

 

Below is my sample data:

HelpM3_0-1706155060204.png

 

There is some calculation that i need to do once names splitted into rows. Really need anyone help to achieve this

 

Thank you

 

1 ACCEPTED SOLUTION

Hi,

Thank you for your message.

Please check the below and the attached file whether it suits your requirement.

 

Jihwan_Kim_0-1706160750924.png

 

 

Table V2 = 
VAR _gt =
    GENERATESERIES ( 1, 100, 1 )
VAR _t =
    ADDCOLUMNS (
        Data,
        "@separator", SUBSTITUTE ( Data[List of Students], ",", "|" )
    )
VAR _generatetable =
    GENERATE ( _gt, ADDCOLUMNS ( _t, "@Name", PATHITEM ( [@separator], [Value] ) ) )
RETURN
    FILTER (
        SELECTCOLUMNS (
            _generatetable,
            "@ClassName", Data[Class Name],
            "@StudentName", [@Name]
        ),
        [@StudentName] <> BLANK ()
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but in my opinion, doing this operation in Power Query Editor is still one of the most preferable way to do it. However, if you only have one option to do this operation which is by DAX, please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_0-1706158877815.png

 

 

Expected result table = 
VAR _t =
    ADDCOLUMNS (
        Data,
        "@separator", SUBSTITUTE ( Data[List of Students], ",", "|" )
    )
VAR _one =
    ADDCOLUMNS ( _t, "@1", PATHITEM ( [@separator], 1 ) )
VAR _two =
    ADDCOLUMNS ( _t, "@2", PATHITEM ( [@separator], 2 ) )
VAR _three =
    ADDCOLUMNS ( _t, "@3", PATHITEM ( [@separator], 3 ) )
VAR _four =
    ADDCOLUMNS ( _t, "@4", PATHITEM ( [@separator], 4 ) )
RETURN
    FILTER (
        SELECTCOLUMNS (
            UNION ( _one, _two, _three, _four ),
            "@ClassName", Data[Class Name],
            "@StudentName", [@1]
        ),
        [@StudentName] <> BLANK ()
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Thank you so much for this @Jihwan_Kim . This is what I wanted. But I have question, based on below syntax i understand that it is based on number of text but what if we dont know how long will be the values? for example in future it might have more than 4? should i just assume it will go up to 20 then I have to set it to var _20 to ensure it will pickup and all values will be splitted accordingly?

 

VAR _one =
    ADDCOLUMNS ( _t, "@1", PATHITEM ( [@separator], 1 ) )
VAR _two =
    ADDCOLUMNS ( _t, "@2", PATHITEM ( [@separator], 2 ) )
VAR _three =
    ADDCOLUMNS ( _t, "@3", PATHITEM ( [@separator], 3 ) )
VAR _four =
    ADDCOLUMNS ( _t, "@4", PATHITEM ( [@separator], 4 ) )  

 

Hi,

Thank you for your message.

Please check the below and the attached file whether it suits your requirement.

 

Jihwan_Kim_0-1706160750924.png

 

 

Table V2 = 
VAR _gt =
    GENERATESERIES ( 1, 100, 1 )
VAR _t =
    ADDCOLUMNS (
        Data,
        "@separator", SUBSTITUTE ( Data[List of Students], ",", "|" )
    )
VAR _generatetable =
    GENERATE ( _gt, ADDCOLUMNS ( _t, "@Name", PATHITEM ( [@separator], [Value] ) ) )
RETURN
    FILTER (
        SELECTCOLUMNS (
            _generatetable,
            "@ClassName", Data[Class Name],
            "@StudentName", [@Name]
        ),
        [@StudentName] <> BLANK ()
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Thank you so much for your help 😀

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.