Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jtkrause14
New Member

Removing Comma after calculated column

I am working with a matrix and created a calcaluted column for a value. The column concatenates all the companies that are in the related to the rows/columns of the matrix with a comma and a line break. however, after the last one I can't seem to find a way to not include the final comma break. 

 

CompanyNames = 
CALCULATE (
    CONCATENATEX (
        VALUES('Customer'[Fully_Qualified_Name]),
        'Customer'[Fully_Qualified_Name] & ", " & UNICHAR(10),
        "" 
    )

)

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jtkrause14 

 

I’m sorry to hear that you can’t removing Comma after calculated column, I'll give you another way to do it:

 

Here's some dummy data

vnuocmsft_0-1703843369040.png

 

Select "Transform data" to enter the power query

vnuocmsft_1-1703843443535.png

 

Select “customerA” and “customerB”, and select “Group By” in the “Transform”

vnuocmsft_2-1703843457514.png

 

Select “Sum” and “Fully_Qualified_Name”

vnuocmsft_3-1703843474495.png

 

Modify the code

vnuocmsft_4-1703843485328.png

 

vnuocmsft_5-1703843485329.png

 

= Table.Group(#"Changed Type", {"customerA", "customerB"}, {{"CompanyName", each Text.Combine([Fully_Qualified_Name], ","), type nullable text}})

 

 

Here is the result, and select “Close & Apply”

vnuocmsft_6-1703843496006.png

View in Desktop

vnuocmsft_7-1703843524587.png

 

Best Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
saud968
Super User
Super User

@jtkrause14 try this

CompanyNames =
CALCULATE (
CONCATENATEX (
VALUES('Customer'[Fully_Qualified_Name]),
'Customer'[Fully_Qualified_Name] &
IF (
'Customer'[Fully_Qualified_Name] <> LASTNONBLANK('Customer'[Fully_Qualified_Name], 1),
", " & UNICHAR(10),
""
),
""
)
)

Anonymous
Not applicable

Hi @jtkrause14 

 

I’m sorry to hear that you can’t removing Comma after calculated column, I'll give you another way to do it:

 

Here's some dummy data

vnuocmsft_0-1703843369040.png

 

Select "Transform data" to enter the power query

vnuocmsft_1-1703843443535.png

 

Select “customerA” and “customerB”, and select “Group By” in the “Transform”

vnuocmsft_2-1703843457514.png

 

Select “Sum” and “Fully_Qualified_Name”

vnuocmsft_3-1703843474495.png

 

Modify the code

vnuocmsft_4-1703843485328.png

 

vnuocmsft_5-1703843485329.png

 

= Table.Group(#"Changed Type", {"customerA", "customerB"}, {{"CompanyName", each Text.Combine([Fully_Qualified_Name], ","), type nullable text}})

 

 

Here is the result, and select “Close & Apply”

vnuocmsft_6-1703843496006.png

View in Desktop

vnuocmsft_7-1703843524587.png

 

Best Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Fowmy
Super User
Super User

@jtkrause14 

Change the -1 in this formual to 2 if necessary 

 

CompanyNames = 
var __m = 
CALCULATE (
    CONCATENATEX (
        VALUES('Customer'[Fully_Qualified_Name]),
        'Customer'[Fully_Qualified_Name] & ", " & UNICHAR(10),
        "" 
    )

)
var __result =  left( __m, len(__m)-1)
RETURN
    __result

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

I get this error when I try to use the left function:

jtkrause14_0-1703101641144.png

 

 

Try this please:

CompanyNames = 
var __m1 = 
CALCULATE (
    CONCATENATEX (
        VALUES('Customer'[Fully_Qualified_Name]),
        'Customer'[Fully_Qualified_Name] & ", " & UNICHAR(10),
        "" 
    )

)

VAR __m = CONVERT ( __m1 , STRING )
var __result =  left( __m,  LEN(__m)-1)
RETURN
    __result
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Still getting the same error.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.