cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SukhRehal
Regular Visitor

Group by single field

Hi everyone, I need some help with the below. I did ask a follow on question here but it probably needs to be a separate question of it's own. 

 

What I trying to achieve is group the location field so that a unique entry only appears once for the LOCATION, is this even possible?

 

 

"<table border='1' width='100%'>" &
"<thead><tr><th>Location</th><th>Items</th></thead>" &
"<tbody>" &
Concat(
    gal_InstallationItems.AllItems,
    "<tr><td>" &
        GroupBy(Location) &
        "</td><td>" &
        Concat(Split(Item, ";"), Result, "<br/>") &
        "</td></tr>") &
"</tbody></table>"

 

 

Also please delete this post if I shouldn't have created it. 

 

Thank you again,

1 ACCEPTED SOLUTION

Accepted Solutions

@SukhRehal ,

What about this ?

 

"<table border='1' width='100%'>" & "<thead><tr><th>Location</th><th>Items</th></thead>" & "<tbody>" & Concat(
    GroupBy(
        gal_InstallationItems.AllItems,
        "Location",
        "ResultColumn"
    ),
    "<tr><td>" &Location & "</td><td>" & With(
        {
            values: Split(
                Concat(
                    ResultColumn,
                    Item & ";"
                ),
                ";"
            )
        },
        Concat(
            FirstN(
                values,
                CountRows(values)-1
            ),
            Result & ";" & "<br>"
        )
    )
) & "</td></tr>" & "</tbody></table>"

 

View solution in original post

3 REPLIES 3
gabibalaban
Dual Super User
Dual Super User

@SukhRehal ,

Try this one:

 

"<table border='1' width='100%'>" & "<thead><tr><th>Location</th><th>Items</th></thead>" & "<tbody>" & Concat(
    GroupBy(
        gal_InstallationItems.AllItems,
        "Location",
        "Result"
    ),
    "<tr><td>" & Location & "</td><td>" & Concat(
        Result,
        Item & ";" & "<br>"
    ) & "</td></tr>"
) & "</tbody></table>"

 

Hope it helps ! 

SukhRehal
Regular Visitor

Thank you, 

 

it does work to an extent, it groups the "Location" column as I wanted it to but it doesn't show the Items in the "Items" column on separate lines it's not replacing the ";" with <br/>.

"<table border='1' width='100%'>" & "<thead><tr><th>Location</th><th>Items</th></thead>" & "<tbody>" & Concat(
    GroupBy(
        gal_InstallationItems.AllItems,
        "Location",
        "Result"
    ),
    "<tr><td>" & Location & "</td><td>" & Concat(
        Result,
        Item & ";" & "<br>"
    ) & "</td></tr>"
) & "</tbody></table>"

 

@SukhRehal ,

What about this ?

 

"<table border='1' width='100%'>" & "<thead><tr><th>Location</th><th>Items</th></thead>" & "<tbody>" & Concat(
    GroupBy(
        gal_InstallationItems.AllItems,
        "Location",
        "ResultColumn"
    ),
    "<tr><td>" &Location & "</td><td>" & With(
        {
            values: Split(
                Concat(
                    ResultColumn,
                    Item & ";"
                ),
                ";"
            )
        },
        Concat(
            FirstN(
                values,
                CountRows(values)-1
            ),
            Result & ";" & "<br>"
        )
    )
) & "</td></tr>" & "</tbody></table>"

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,438)