The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All,
I have a table with comments for different Product IDs. Some Product ID can have several comments in multiple line.
I would like to group this table by product ID along with a comment column which includes all the comments merged into 1 cell. The aim is to avoid any duplicatd Product ID. I would like to separate each comment within the cells in new lines (see example below).
Thanks for all tips in advance.
Solved! Go to Solution.
Hi @BalazsNy Rather creating table, you need to create measure. In table inline will not work as you expect.
Try below code to create measure:
MergedComments =
VAR CurrentProductID = SELECTEDVALUE(YourTableName[Product ID])
RETURN
CONCATENATEX(
FILTER(YourTableName, YourTableName[Product ID] = CurrentProductID),
YourTableName[Comment],
UNICHAR(13) & UNICHAR(10)
)
Create a table visual, place Product ID in the rows section and MergedComments in the value section. And you done. You will get the final as you desired. See image:
Hope this helps!!
If this solved your problem, please mark this as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Hi @BalazsNy Rather creating table, you need to create measure. In table inline will not work as you expect.
Try below code to create measure:
MergedComments =
VAR CurrentProductID = SELECTEDVALUE(YourTableName[Product ID])
RETURN
CONCATENATEX(
FILTER(YourTableName, YourTableName[Product ID] = CurrentProductID),
YourTableName[Comment],
UNICHAR(13) & UNICHAR(10)
)
Create a table visual, place Product ID in the rows section and MergedComments in the value section. And you done. You will get the final as you desired. See image:
Hope this helps!!
If this solved your problem, please mark this as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Thank you. It works perfectly.
Hi @BalazsNy
Try these:
as a measure =
CONCATENATEX ( 'table', 'table'[comment], UNICHAR ( 10 ) )
as a calc column =
CONCATENATEX (
ALLEXCEPT ( 'table', 'table'[product id] ),
'table'[comment],
UNICHAR ( 10 )
)