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 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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,254)