cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Help Creating PIE CHART of Cost Categories

Hello! Would appreciate anyone's help trying to recreate the pie chart below in PowerApps. 

I can't figure out how to do a single pie chart for one record, in this case record #53070. 

When I am in this record in the App I only want to see cost buckets for this record. 

Data source (Sharepoint List) is posted below... thanks in advance!

Untitled picture.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @PMLISA

 

To display the data in your desired format, you would need to transpose your data values into rows. The structure would look like this.

 

Cost             Amount
----------------------------------
Purchasing       3420.18
Expense          1201.68 

We can use the table function to build this structure. The formula we would use for the items property of the chart would look like this:

 

Table({Cost:"Purchasing", Amount:LookUp(Projects,ProjectID=53070).SOPCost},
      {Cost:"Expense", Amount:LookUp(Projects, ProjectID=53070).SOECost}
)

You can replace the hardcoded ProjectID value with a reference to a control value. In the properties of the chart, you would set the Labels and Series properties as shown beneath.

 

chart1.JPG

 

 

 

View solution in original post

5 REPLIES 5
Community Support
Community Support

Hi @PMLISA,

 

Please try to create a collection with the fields that you want to show in the Pie Chart and then use this collection on the Pie Chart control.

 

About Pie chart:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/use-line-pie-bar-chart

About collection:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-update-collection

 

Regards,

Mona

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

Hi @PMLISA

 

To display the data in your desired format, you would need to transpose your data values into rows. The structure would look like this.

 

Cost             Amount
----------------------------------
Purchasing       3420.18
Expense          1201.68 

We can use the table function to build this structure. The formula we would use for the items property of the chart would look like this:

 

Table({Cost:"Purchasing", Amount:LookUp(Projects,ProjectID=53070).SOPCost},
      {Cost:"Expense", Amount:LookUp(Projects, ProjectID=53070).SOECost}
)

You can replace the hardcoded ProjectID value with a reference to a control value. In the properties of the chart, you would set the Labels and Series properties as shown beneath.

 

chart1.JPG

 

 

 

View solution in original post

Thank you this worked great! If I wanted the graph to change based on the ProjectID I was viewing, what would I replace the "53070" with? 

Glad that works. Supposing that you reach your pie chart screen via a gallery control that displays projects, you can replace 53070 with a reference to the gallery control. The syntax would look something like:

 

Gallery1.Selected.ProjectID
Frequent Visitor

After fiddling around with this, I stumbled across a much simpler implementation of your problem.

In the Items property, you'll find 

 

Table(
{Cost: "Purchase",Amount:BrowseGallery1.Selected.SPOCost},
{Cost: "Expense",Amount:BrowseGallery1.Selected.SOECost}
)

 

will also achieve the result you're after.

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,210)