Forum Discussion
Multirow into Single Row for Multiple Column
- 6 years ago
hi damit23183
Just add a filter to remove blank as below:
SWITCH(TRUE(), NOT(ISBLANK([Basis])),
CALCULATE(CONCATENATEX ('Table', [Basis],", ", [caseID]) ,FILTER ( 'Table', 'Table'[CaseID] = EARLIER ( 'Table'[CaseID] )&&'Table'[Basis]<>BLANK())), BLANK())By the way, I would suggest you use this formula to create a new table
New Table = SUMMARIZE( 'Claims', [CaseID], "Title",CONCATENATEX(DISTINCT('Claims'[Title]),[Title],","), "Type",CONCATENATEX(DISTINCT('Claims'[Type]),[Type],","), "Basis",CALCULATE(CONCATENATEX(DISTINCT('Claims'[Basis]),[Basis],","),FILTER('Claims','Claims'[Basis]<>BLANK())) )or
New Table = SUMMARIZE( 'Claims', [CaseID], "Title",CALCULATE(CONCATENATEX(DISTINCT('Claims'[Title]),[Title],","),FILTER('Claims','Claims'[Basis]<>BLANK())), "Type",CALCULATE(CONCATENATEX(DISTINCT('Claims'[Type]),[Type],","),FILTER('Claims','Claims'[Basis]<>BLANK())), "Basis",CALCULATE(CONCATENATEX(DISTINCT('Claims'[Basis]),[Basis],","),FILTER('Claims','Claims'[Basis]<>BLANK())) )and here is sample pbix file, please try it.
Regards,
Lin
damit23183 I cannot replicate your problem. When I try with your sample data, I have no comma.
Does your full dataset contain some blanks for Basis? That might be what is causing the leading comma with no text before it. If so, you can use an IF or other option to check for blanks, or add a condition to the FILTER using && to check that Basis is not blank.
Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos.
I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.