Forum Discussion
CONCATENATEX unique value
Hi
I have a two tables are Data and Report, both tables contain the same headers are “Item” and “Comments”.
DATA
In data table the item columns contains prefix only and the same item contain multiple comments.
| ITEM | COMMENTS |
| 45 | |
| 45 | |
| 123456DMK | RETURN |
| 123456DMK | RETURN |
| 2345678ADMK | NON-RETURN |
| 2345678ADMK | NON-RETURN |
| 2345678ADMK | |
| 2345678ADMK | |
| 12345TR | RETURN |
| 12345TR | NON-RETURN |
| 12345TR |
REPORT
In report table the item columns contain prefix and suffix. The unique key is prefix for both tables in order to match tables from “Data” to “Report”. I would like to bring it the unique comments from Data table into the Report Table.
| ITEM | COMMENTS |
| 44 | NA |
| 45 | |
| 123456DMK | RETURN |
| 123456DMK-001 | RETURN |
| 123456DMK-002 | RETURN |
| 123456DMK-001DMK | RETURN |
| 2345678ADMK | NON RETURN |
| 2345678ADMK-BJP | NON RETURN |
| 2345678ADMK-0123 | NON RETURN |
| 2345678ADMK-234ME | NON RETURN |
| 2345678ADMK-DMK | NON RETURN |
| 12345TR | RETURN|-|NON-RETURN |
| 12345TR-001 | RETURN|-|NON-RETURN |
| 12345TR-002 | RETURN|-|NON-RETURN |
| 12345TR-003 | RETURN|-|NON-RETURN |
| 12345TR-004 | RETURN|-|NON-RETURN |
| 12345TR-005 | RETURN|-|NON-RETURN |
DESIRED RESULT
- In Data table the same item contain two different comments in this scenario I would like to get the both comments in the same cell without duplication.
- In Data table the same item contain repeated comments also banks as well in this scenario I would like to get the comments in the same cell without repetition.
- In Report table the item can’t found in data table then return “NA” and if it’s blanks and return blanks.
DATA
REPORT:
DESIRED RESULT:
6 Replies
- Saxon10Post Prodigy
I created helper column for item in report table (Keep only prefix-item1) and I apply the following calulated column
CONCATENATEX(FILTER(ALL(DATA),DATA[ITEM]=EARLIER(REPORT[ITEM1])),DATA[COMMENTS]),"||") but it will bring it duplicated comments.I would like to achieve my desired result without duplication columns.Any advise please. - MFelixSuper User
Hi Saxon10 ,
I have created a table with the SUFIX and a column on the report also with the sufix then made the following setup:
Now add the following measure:
Comments Values = COALESCE ( CALCULATE ( CONCATENATEX ( VALUES ( DATA[Comments] ); DATA[Comments]; "|-|" ); CROSSFILTER ( REPORT[SUFIX]; SUFIX[SUFIX]; BOTH ) ); "NA" )Result below and in attach PBIX file: