Forum Discussion
Creative_tree88
1 year agoHelper V
Comma Separated to One Row using DAX
Hi all - I have some data (see sample attached), which has been derived using the following DAX: Exam Range = VAR _start = 'SLAM Data Nov 24'[Admission Date] VAR _end = 'SLAM Data Nov 24'[Dis...
- 1 year ago
Hi Creative_tree88 ,
You can achieve the desired result by creating a new calculated table using the following DAX:
NewTable = VAR Separator = "|" RETURN SELECTCOLUMNS( GENERATE( 'YourOriginalTable', VAR ExaminationsList = SUBSTITUTE('YourOriginalTable'[Examinations], ",", Separator) RETURN SELECTCOLUMNS( GENERATESERIES(1, LEN(ExaminationsList) - LEN(SUBSTITUTE(ExaminationsList, Separator, "")) + 1), "Report ID2", [Report ID], "SplitValue", PATHITEM(ExaminationsList, [Value], TEXT) ) ), "Report ID2", [Report ID2], "SplitValue", [SplitValue] )
Your output will look like this:Make sure to replace table and columns names with your owns.
Kedar_Pande
1 year agoSuper User
- In Power query, select the column containing the comma-separated exams.
- Use the Split Column functionality to split the exams into separate rows. You can use the Split to Rows feature or perform a custom split by delimiter.
- Add the Report ID column by referencing the unique code for each exam in the table.
💌 If this helped, a Kudos 👍 or Solution mark ✅ would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn