cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PMLISA
Level: Powered On

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
Super User
Super User

Re: Help Creating PIE CHART of Cost Categories

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 Team
Community Support Team

Re: Help Creating PIE CHART of Cost Categories

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

Re: Help Creating PIE CHART of Cost Categories

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

PMLISA
Level: Powered On

Re: Help Creating PIE CHART of Cost Categories

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? 

Super User
Super User

Re: Help Creating PIE CHART of Cost Categories

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
Highlighted
Eric3
Level: Powered On

Re: Help Creating PIE CHART of Cost Categories

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
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,872)