web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove last character
Power Apps
Answered

Remove last character

(0) ShareShare
ReportReport
Posted on by 113
Hey Guys, I am trying to remove the last character (;) length using this formula - 
Left(Concat(ForAll(Distinct(Gallery29.AllItems, Process), Value), Value&"; "), Len(Concat(Gallery29.AllItems, Process&"; "))-2)
 
But its not removing it, even if I try -3 or -10. Not sure if this has something to do with the formula since its using a gallery. If anyone can help me with the correct formula, I'll appreciate it. 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    I think the problem is that you are using two different formulas in the first vs second parameter of you Left() function. In the first half you use ForAll and Distinct, but in the second you don't so the second parameter generates a longer length than the first.  Try breaking it into two lines and using a temporary variable.
     
    Set(tempString, Concat(ForAll(Distinct(Gallery29.AllItems, Process), Value), Value&"; "));
    Left(tempString, Len(tempString)-2);
     

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Vish WR Profile Picture
    3,748 on at
     

    Your formula is not removing the last `;` because you are using two different Concat expressions

    - One to build the string

    - Another way to calculate the length

    This mismatch makes Len() inaccurate, so subtracting -2, -3, etc. will not consistently work.

    Use TrimEnds() to remove the trailing delimiter safely:

    TrimEnds(

        Concat(

            Distinct(Gallery29.AllItems, Process),

            Value & "; "

        )

    )


     
  • Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    TrimEnd() won't work because it only removes trailing spaces, not characters like ';'

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • 11manish Profile Picture
    3,333 on at
    you can also try below :
     
    With(
        {
            result: Concat(
                Distinct(Gallery29.AllItems, Process),
                Value & "; "
            )
        },
        Left(result, Len(result) - 2)
    )
  • Verified answer
    WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    You need to trim the character off each value before you apply the Concat (or you are simply trimming the end of the complete output string).
     
    This should work for you - I have used -1 as you said you needed the last character removed - use -2 if that is what you need.
    Concat(
       Distinct(
          AddColumns(
             Gallery29.AllItems,
             TempField,
             Left(
                Process,
                Len(Process) - 1
             )
          ),
          TempField
       ),
       Value,
       "; "
    )
    Also note that Result is no longer the output of Distinct (although ChatGPT often returns that solution when accessing older information) - it is now Value
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Pstork1 Profile Picture
    69,556 Most Valuable Professional on at
    @WarrenBelz I actually think what he is trying to do is use Concat to build a semi-colon delimited string. But that always adds an extra ';' at the end of the delimited string. I think that is the semi-colon he is trying to get rid of.  Not the one between each entry.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Ram Prakash Duraisamy Profile Picture
    5,877 Super User 2026 Season 1 on at
    You can try below
     
    With(
        {
            result: Concat(
                Distinct(Gallery.AllItems, Process),
                Value & "; "
            )
        },
        Left(result, Len(result) - 2)
    )
  • WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    Yes you are correct, I over-read this  - to eliminate the last ; character all that is needed is simply using Value, "; " instead of Value & "; ". as below
    Concat(
       Distinct(
          Gallery29.AllItems,
          Process
       ),
       Value,
       "; "
    )
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard