cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Soumodip
Level: Power Up

Count number of true and false against a name in a collection

I have a collection:

Collection.jpg

I want to create a new collection from this one which will have items like:

Jack2
Jon0
Jim0

 

Since Jack has two "true" against his name and the others have none.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Count number of true and false against a name in a collection

Hi @Soumodip ,

Do you want to create a new collection based on the true or false value against the Title column?

 

Based on the needs that you mentioned, I think the GroupBy function and the AddColumns function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Add a button in your app, set the OnSelect property to following:

 

ClearCollect(
             NewCollection,
             DropColumns(
                        AddColumns(
                                   GroupBy(
                                            OriginalCollection,
                                            "Title",
                                            "GroupData"
                                   ),
                                   "BooleanValue",
                                   CountIf(GroupData, ShAlxxxField = true)
                        ),
                        "GroupData"
            )
)

 

Then add a Data Table control in your app, set the Items property to following:

 

NewCollection

 

then enable the Title field and BooleanValue field within this Data Table, then the data would show up within this Data Table.

Note: The ShAlxxxField represents the ShAlxxx field within your Original colelction.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
eka24
Level 10

Re: Count number of true and false against a name in a collection

Make use of GroupBy functions. Video from Brian Knight
https://youtu.be/q42ibovAqZc

You can:

  1. Insert a Gallery1 and set its items Property to: GroupBy('My Collection',"Title","TrueFalseCount")
  2. In one of the Textbox inside the Gallery Set it Text to: ThisItem.Title
  3. In Another Textbox2 INSIDE the Gallery1, put this formula: CountRows(TrueFalseCount)

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Community Support Team
Community Support Team

Re: Count number of true and false against a name in a collection

Hi @Soumodip ,

Do you want to create a new collection based on the true or false value against the Title column?

 

Based on the needs that you mentioned, I think the GroupBy function and the AddColumns function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Add a button in your app, set the OnSelect property to following:

 

ClearCollect(
             NewCollection,
             DropColumns(
                        AddColumns(
                                   GroupBy(
                                            OriginalCollection,
                                            "Title",
                                            "GroupData"
                                   ),
                                   "BooleanValue",
                                   CountIf(GroupData, ShAlxxxField = true)
                        ),
                        "GroupData"
            )
)

 

Then add a Data Table control in your app, set the Items property to following:

 

NewCollection

 

then enable the Title field and BooleanValue field within this Data Table, then the data would show up within this Data Table.

Note: The ShAlxxxField represents the ShAlxxx field within your Original colelction.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Soumodip
Level: Power Up

Re: Count number of true and false against a name in a collection

Thanks! Solution worked perfectly.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,403)