cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Antonio
Helper II
Helper II

Group by item in multiple formula

Dear all, I have the following statement below:

 

SortByColumns(Search(Filter('Table1',Dropdown1.SelectedText.Value in Choice 1&& Dropdown1_1.SelectedText.Value in Choice 2), TextSearchBox1.Text,"Item"), "Item", If(SortDescending1, Descending, Ascending)),

 

I'd like to insert the group by 'Item' into the above formula but i don't know where i need to insert the statement.

 

Could you please support me?

 

Thanks a lot in advance.

9 REPLIES 9
WarrenBelz
Super User
Super User

 

Hello @Antonio ,

You might try something like this - I have not tested it, but it should work.

SortByColumns(
   Search(
      Filter(
         GroupBy(
            'Table1',
            [YourGroupField]
         ),
         Dropdown1.SelectedText.Value in Choice 1 &&
         Dropdown1_1.SelectedText.Value in Choice 2
      ),
      TextSearchBox1.Text,"Item"
   ),
   "Item",
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

 
Please click Accept as solution 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 Thumbs Up.

Hello,

 

i've been able to do additional progresses and I've changed the formula as follows:

SortByColumns(Search(GroupBy('Table1',"Item","Description1","Description2","Description3"),TextSearchBox1.Text,"Item"), "Item", If(SortDescending1, Descending, Ascending)))

 

In fact it is working for items as below on the DB

 

Item    Description1 Description2 Description3 Location
1               A                 B                      C                 1

 

BUT it is not grouping. In fact, it is not working for repeated items (the reason why I want to groupByItem)

Item    Description1 Description2 Description3 Location
1               A                  B                  C                     1

1               A                  B                  C                     2

1               A                  B                  C                     3

 

Can you help me to check what is wrong?

 

Thanks a lot

 

Hi @Antonio ,

Apologies - I left out the Group name which is required (typing from memory on a phone is never good)

SortByColumns(
   Search(
      Filter(
         GroupBy(
            'Table1',
            [YourGroupField],
            "[YourGroupName]"
         ),
         Dropdown1.SelectedText.Value in Choice 1 &&
         Dropdown1_1.SelectedText.Value in Choice 2
      ),
      TextSearchBox1.Text,"Item"
   ),
   "Item",
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

But as you are grouping by multiple columns, you will also need AddColumns.

Here is a post from last week I did on a related topic - please see if this helps you.

 

Please click Accept as solution 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 Thumbs Up.

Hello,

 

unfortunately, it is still not working.

 

In particular, when it comes to add fields in the gallery like YourGroupName.Table1FieldName i got an error-

 

How can i get it solved?

 

Thanks a lot

 

Regards

I would suggest you take a screenshot of the results or output that you desire if the formula worked as expected. That would help.

Hi @Antonio ,

I assume you have replaced everything [in square brackets] with the name of your field or control without the brackets.

My code was simply an example of the structure you need to use.

Hello,

 

yes i did it.

 

This is the formula:

SortByColumns(Search(GroupBy('Table1',"ITEM","GRPBYITEM"),TextSearchBox1.Text,"ITEM"), "ITEM", If(SortDescending1, Descending, Ascending))

 

Then, when i try to add the to the Gallery1 the fields i need to be displayed i got the following message:"this formula uses scope which is not presently supported for evaluation"

 

Image is attached.

 

Thanks a lot

 

 

Hello @Antonio ,

Sorry I missed your post.

A colleague of mine @Eelman is very good at complex formulas - I have tagged him to see if he can assist.

@WarrenBelz Thanks for the tag .

@Antonio 
Could you please provide a screenshot of your data source and as well as the outcome you are wanting, maybe a simple example built in Excel for the latter? Could you also tell me the Items property of your gallery.

Im not 100% sure of your expectations but is seems to me that you are trying to reference a table by using a record, which is causing the error. I'm thinking a gallery inside your current gallery may suit your needs but can't be sure until I see what is going on.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,319)