Skip to main content
Community site session details

Community site session details

Session Id : O8FzfpkPg2SgswweSiRp6h
Power Apps - Building Power Apps
Unanswered

Pie Chart: GroupBy

Like (0) ShareShare
ReportReport
Posted on 22 Mar 2017 08:09:13 by 7

Hi Everyone, We are in need of help with grouping in Pie Chart.

 

Our current pie chart

 

Our target is

 

How are we going to achieve this? 

Label: Type

Series: RecordId

 

We have been playing with GroupBy and ClearCollect but no luck, we are having a hard time making our code work.

 

We just started using PowerApps today and still familiarizing ourselves on constructing formulas. Thanks in advance!

  • LMP Profile Picture
    7 on 23 Mar 2017 at 11:09:33
    Re: Pie Chart: GroupBy

    Hi All,

     

    We have achieved our goal. We followed the post by hpkeong here: https://powerusers.microsoft.com/t5/PowerApps-Forum/Help-with-a-formula-to-extract-data-from-one-Collection-into/m-p/19810#M8669

     

  • LMP Profile Picture
    7 on 23 Mar 2017 at 07:33:59
    Re: Pie Chart: GroupBy

    Hi All,

     

    We have added a new column with type of int and populated values to it. We then used this value field but it is diplaying the same sizes for each slices.

     Chart1.png

    AddColumns(GroupBy(Case, "WorkItemType_", "Value_"),"Count", Count(Case.Value_)) 

     

     

    We also tried the below formula...

    Sum.png

     

    Any help is appreciated. Thanks in advance!

     

  • LMP Profile Picture
    7 on 23 Mar 2017 at 02:43:00
    Re: Pie Chart: GroupBy

    Hi Brank and Carlos,

     

    We are using a Common Data Service as the source of the records. Below are the data on the excel file.

     

    CASEID		ARRIVALDATE			CATEGORY	CLOSEDATE				CURRENTCONTACT_CONTACTID	CUSTOMERSATISFACTIONCODE	ORIGINCODE	SEVERITY	SOLUTIONTYPE		STATUS		WORKITEMTYPE_
    CASE001		2016-03-15 19:00:00.0000000	Question	2016-04-01 00:00:00.0000000		CON001				VerySatisfied			Phone		Normal		SolvedByCustomer	Active		Inspection
    CASE002		2016-02-02 00:00:00.0000000	Problem		2016-04-02 00:00:00.0000000		CON002				VerySatisfied			Email		Normal		SolvedByCustomer	Resolved	Inspection
    CASE003		2016-02-04 00:00:00.0000000	Question	2016-04-04 00:00:00.0000000		CON003				Neutral				Phone		High		SolvedByCustomer	Resolved	Infraction
    CASE004		2016-02-05 00:00:00.0000000	Problem		2016-04-05 00:00:00.0000000		CON004				VerySatisfied			Email		Normal		SolvedByCustomer	Active		Maintenance
    CASE005		2016-02-06 00:00:00.0000000	Request		2016-04-06 00:00:00.0000000		CON005				VerySatisfied			Web		Normal		SolvedByCustomer	Active		OnBoarding
    CASE006		2016-02-07 00:00:00.0000000	Question	2016-04-07 00:00:00.0000000		CON006				Neutral				Phone		High		SolvedByCustomer	Resolved	Infraction
    CASE007		2016-02-08 00:00:00.0000000	Problem		2016-04-08 00:00:00.0000000		CON007				VerySatisfied			Email		Normal		SolvedByCustomer	Active		Inspection
    CASE008		2016-02-09 00:00:00.0000000	Request		2016-04-09 00:00:00.0000000		CON008				Neutral				Web		High		SolvedByCustomer	Active		OperatorError
    CASE013		2016-03-05 00:00:00.0000000	Problem		1899-12-31 20:00:00.0000000		CON001				VerySatisfied			Web		High		SolvedByCustomer	Active		OperatorError
    CASE016		2016-03-15 17:00:00.0000000	Problem		1899-12-31 20:00:00.0000000		CON001				VerySatisfied			Web		Normal		SolvedByCustomer	Active		Inspection

     

     

     

  • CarlosFigueira Profile Picture
    on 22 Mar 2017 at 15:59:56
    Re: Pie Chart: GroupBy

    Assuming that your Active Types collection is created as such:

    ClearCollect(coll1,
     { type: "OperatorError", value: 1 },
     { type: "Inspection", value: 1 },
     { type: "Inspection", value: 1 },
     { type: "Inspection", value: 1 },
     { type: "Infraction", value: 1 },
     { type: "Maintenance", value: 1 },
     { type: "OnBoarding", value: 1 },
     { type: "Infraction", value: 1 },
     { type: "Inspection", value: 1 },
     { type: "OperatorError", value: 1 })

    Then you can group by the type using the formula below:

    ClearCollect(coll2,
     AddColumns(
     GroupBy(coll1, "type", "bytype"),
     "sumtype",
     Sum(bytype, value)))

    When you add a pie chart using 'coll2' in the Items property, you should get the chart that you described. The formula above first groups all the items in the original collection by the 'type' column, then adds a new column that sums the 'value' property of each group.

  • Brank Profile Picture
    149 on 22 Mar 2017 at 12:06:40
    Re: Pie Chart: GroupBy

    For help you I would like to know what do you have in the property "Items" of the PieChart, if it is a context variable, how do you create it?

     

    Regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!