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 / Trying to use Concat t...
Power Apps
Answered

Trying to use Concat to merge values in a string with constraint

(0) ShareShare
ReportReport
Posted on by 380
I have a Sharepoint list called MeterReadings which has a field called auth. This field can contain one value like "9876AP6829" or many values like "9876AP6829; 9875AP6829; 9874AP6829"

I am trying to merge all the values together IF 1 value is present more than once within that subset - please see the example attached for what I am trying to achieve
 
My Gallery Items is:
GroupBy(
    SortByColumns(
        Filter(
            MeterReadings,
            readdate >= (DatePickerFrom_5.SelectedDate) && readdate <= DatePickerTo_5.SelectedDate && (StartsWith(
                auth,
                TextInput2.Text
            ) || StartsWith(
                clientname,
                TextInput2.Text
            ))
        ),
        "auth"
    ),
    auth,
    Data
)
A little more explanation could be useful; The MeterReadings table contains water meter readings for a client/s. A client is identified by an auth or a number of auths or a combination of auths separated by "; "
If, for example there is a MeterReading against auth 05629K AND there is another reading against 05629K; 624367; 624368; 624918 it's very likely that this is the same client and so we want to combine or merge all the auths that look like they are related and then calculate water usage based on ALL those meter readings. I hope I have explained this correctly - the spreadsheet attached has sample data and expected outcomes
 
I would like to put the Concat within/on the end of this if possible
thanking you :)
Categories:
I have the same question (0)
  • ronaldwalcott Profile Picture
    3,862 Moderator on at
    Are you just trying to display the items in that manner or modify the list?
    How many records would you be accessing as there would be delegable issues?  
  • bobgodin Profile Picture
    380 on at
    @ronaldwalcott 
    I just want to modify the list so I can calculate usage based on the new auths value
    I'm accessing 8000 records but I have created a collection on startup which gathers all records
  • bobgodin Profile Picture
    380 on at
    Hi @WarrenBelz or @RandyHayes is there any chance one of you could help me with this one - I have had no response with a solution so far?
     
    thank you
  • WarrenBelz Profile Picture
    154,447 Most Valuable Professional on at
    Hi @bobgodin​​​​​​​
    I am rather confused as to how the right table is extracted from the left one (the logic behind this - where are the additional values being identified from ?)
  • Verified answer
    WarrenBelz Profile Picture
    154,447 Most Valuable Professional on at
    I see it now. I think you will appreciate the complexity of this from the code below - fried a few brain cells on the way . . .
    I have no idea however how your device is going to handle this through an 8,000 records collection (and none of it is remotely Delegable)
    ShowColumns(
       AddColumns(
          AddColumns(
             Table1,
             Base,
             If(
                ";" in auth,
                First(
                   Split(
                      auth,
                      ";"
                   )
                ).Value,
                auth
             )
          ),
          mergedauths,
          LookUp(
             AddColumns(
                GroupBy(
                   Ungroup(
                      AddColumns(
                         AddColumns(
                            Table1,
                            Auths,
                            Split(
                               auth,
                               ";"
                            ).Value
                         ),
                         MainAuth,
                         First(Auths).Value
                      ),
                      Auths
                   ),
                   MainAuth,
                   Data
                ),
                AllAuths,
                Concat(
                   Distinct(
                      Data,
                      Value
                   ),
                   Value,
                   ";"
                )
             ),
             MainAuth = Base
          ).AllAuths
       ),
       mergedauths,
       readdate,
       reading
    )
     
    Please click 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 giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • bobgodin Profile Picture
    380 on at
    Hi @WarrenBelz thank you so much - that code has done the trick - just one more silly question:
    How can I incorporate that into my Items property for my Gallery:
     
    GroupBy(
        SortByColumns(
            Filter(
                colMRsbyWMA,
                readdate >= DatePickerFrom_3.SelectedDate && readdate <= DatePickerTo_3.SelectedDate && StartsWith(
                    wma,
                    Dropdown2_1.Selected.Result
                ) && (TextInput2.Text in auth || StartsWith(
                    clientname,
                    TextInput2.Text
                ))
            ),
            "auth"
        ),
        auth,
        Data
    )
     
    and btw I am using a collection to start with and then creating a smaller collection when the user chooses a wma value from Dropdown and THAT'S where the Concat/Split etc is applied
  • Verified answer
    WarrenBelz Profile Picture
    154,447 Most Valuable Professional on at
    You can get the filter in near the top as shown below, but the auth column no longer exists (you wanted mergedauths) as per the sample you posted and it is already grouped to achieve this added column. 
    ShowColumns(
       AddColumns(
          AddColumns(
             Filter(
                colMRsbyWMA,
                readdate >= DatePickerFrom_3.SelectedDate && 
                readdate <= DatePickerTo_3.SelectedDate && 
                StartsWith(
                   wma,
                   Dropdown2_1.Selected.Result
                ) && 
                (
                   TextInput2.Text in auth || 
                   StartsWith(
                      clientname,
                      TextInput2.Text
                   )
                )
             ),
             Base,
             If(
                ";" in auth,
                First(
                   Split(
                      auth,
                      ";"
                   )
                ).Value,
                auth
             )
          ),
          mergedauths,
          LookUp(
             AddColumns(
                GroupBy(
                   Ungroup(
                      AddColumns(
                         AddColumns(
                            colMRsbyWMA,
                            Auths,
                            Split(
                               auth,
                               ";"
                            ).Value
                         ),
                         MainAuth,
                         First(Auths).Value
                      ),
                      Auths
                   ),
                   MainAuth,
                   Data
                ),
                AllAuths,
                Concat(
                   Distinct(
                      Data,
                      Value
                   ),
                   Value,
                   ";"
                )
             ),
             MainAuth = Base
          ).AllAuths
       ),
       mergedauths,
       readdate,
       reading
    )
     
    Please click 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 giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard