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
Super User
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>"

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,180)