Forum Discussion
Creative_tree88
1 year agoHelper V
Comma Separated Values
Hi all - I need to go from this: Report ID Examinations 57818 FCNRTJ 53863 ZANAE,IBIOPB,IBILXD,FPTCH 50320 FNVRK 31285 UFOOLJ 75614 UGMDCI 70578 UNECKN 47734 CLUN...
- 1 year ago
You can make use of PATHITEM and then some crossjoins.
-calculated table DAXSplit = VAR _Path = --add a pathitem column by substituting commas with pipes ADDCOLUMNS ( 'Table', "@PathItem", SUBSTITUTE ( 'Table'[Examinations], ",", "|" ) ) VAR _MaxLength = --get the overall max path length MAXX ( ADDCOLUMNS ( _Path, "@PathLength", PATHLENGTH ( [@PathItem] ) ), [@PathLength] ) VAR _Crossjoined = CROSSJOIN ( _Path, GENERATESERIES ( 1, _MaxLength, 1 ) ) VAR _ExamItem = FILTER ( ADDCOLUMNS ( _Crossjoined, "Exam Item", PATHITEM ( [@PathItem], [Value], TEXT ) ), NOT ( ISBLANK ( [Exam Item] ) ) ) RETURN SELECTCOLUMNS ( _ExamItem, "Report ID", [Report ID], "Examinations", [Examinations], [Exam Item] )Please see the attached sample pbix.
danextian
1 year agoSuper User
You can make use of PATHITEM and then some crossjoins.
-calculated table
DAXSplit =
VAR _Path =
--add a pathitem column by substituting commas with pipes
ADDCOLUMNS (
'Table',
"@PathItem", SUBSTITUTE ( 'Table'[Examinations], ",", "|" )
)
VAR _MaxLength =
--get the overall max path length
MAXX (
ADDCOLUMNS ( _Path, "@PathLength", PATHLENGTH ( [@PathItem] ) ),
[@PathLength]
)
VAR _Crossjoined =
CROSSJOIN ( _Path, GENERATESERIES ( 1, _MaxLength, 1 ) )
VAR _ExamItem =
FILTER (
ADDCOLUMNS (
_Crossjoined,
"Exam Item", PATHITEM ( [@PathItem], [Value], TEXT )
),
NOT ( ISBLANK ( [Exam Item] ) )
)
RETURN
SELECTCOLUMNS (
_ExamItem,
"Report ID", [Report ID],
"Examinations", [Examinations],
[Exam Item]
)
Please see the attached sample pbix.