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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Remove Final Comma and Space from Concatenated Column

Hello,

 

I've created a column in my data that has a nested concatenation to determine when a cell within three particular columns has a blank value. The concatenation is working and allows me to display a user friendly message with all of the missing fields in one column. My issue is that I am unable to remove the trailing ", " from the text string that is produced. Is it possible to modify my DAX to drop the last two characters of the string?

 

Here is my current DAX:

QA Issue = CONCATENATE(IF('Consolidated RAID Log'[Event]=BLANK(),"Missing Event, ",""),CONCATENATE(IF('Consolidated RAID Log'[Owner]=BLANK(),"Missing Owner, ",""),CONCATENATE(IF('Consolidated RAID Log'[Due Date]=BLANK(),"Missing Due Date, ",""),"")))
 
Screenshot of current output:
Lowghen_0-1674770332920.png

Thank you!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous Try:

QA Issue = 
  VAR __String = CONCATENATE(IF('Consolidated RAID Log'[Event]=BLANK(),"Missing Event, ",""),CONCATENATE(IF('Consolidated RAID Log'[Owner]=BLANK(),"Missing Owner, ",""),CONCATENATE(IF('Consolidated RAID Log'[Due Date]=BLANK(),"Missing Due Date, ",""),"")))
  VAR __Result = IF(RIGHT(__String, 1) = ",", LEFT(__String, LEN(__String) - 1), __String)
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Anonymous Try:

QA Issue = 
  VAR __String = CONCATENATE(IF('Consolidated RAID Log'[Event]=BLANK(),"Missing Event, ",""),CONCATENATE(IF('Consolidated RAID Log'[Owner]=BLANK(),"Missing Owner, ",""),CONCATENATE(IF('Consolidated RAID Log'[Due Date]=BLANK(),"Missing Due Date, ",""),"")))
  VAR __Result = IF(RIGHT(__String, 1) = ",", LEFT(__String, LEN(__String) - 1), __String)
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

 

Hi Greg,

 

Thank you so much for your quick reply. I had to make some small adjustments, but this was exactly what I needed! 

 

I used your version and updated the Right function to look for a space and changed the - 1 to a - 2  to account for the additional space after the comma:

  VAR __Result = IF(RIGHT(__String, 1) = " ", LEFT(__String, LEN(__String) - 2), __String)
 
Thanks again!
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.