cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
solidus
Frequent Visitor

Using charts show distribution of values in a column

Hi,

 

I'm have a table with some columns which are numerical values. I would like to use the charts functionality to show the distribution of these values. I tried creating a new table in the underlying excel spreadsheet but I got an error saying that spreadsheet formula are not yet supported.

 

Is there a way inside PowerApps to plot this easily.

 

At the moment my data looks like

 

Risks.Severity

Between 0 and 10. And I would like, for example to plot the data below (where the 2nd column is the number if Risks with severity 0, 1, 2 etc.).

 

0    0

1    3

2    6

3    9

4    2

5    1

6    0

7    0

8    0

9    1

10  1

 

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
CarlosFigueira
Power Apps
Power Apps

You can use the GroupBy function to aggregate the data. In your case, if you have a data source with a Severity column, and you want to aggregate on the number of issues with each severity (like in the table below):

ClearCollect(Risks,
    {Severity: 1, Name: "Issue 01"},
    {Severity: 1, Name: "Issue 02"},
    {Severity: 1, Name: "Issue 03"},
    {Severity: 2, Name: "Issue 04"},
    {Severity: 2, Name: "Issue 05"},
    {Severity: 2, Name: "Issue 06"},
    {Severity: 2, Name: "Issue 07"},
    {Severity: 2, Name: "Issue 08"},
    {Severity: 2, Name: "Issue 09"},
    {Severity: 3, Name: "Issue 10"},
    {Severity: 3, Name: "Issue 11"},
    {Severity: 3, Name: "Issue 12"}, ...
 )

Then you can insert a new chart control, and in its Items property, you can group the Risks table by the severity, and add a new column to the group that uses the CountRows function to find out how many issues with a given severity exist:

AddColumns(GroupBy(Risks, "Severity", "BySeverity"), "Count", CountRows(BySeverity))

For example this is the rendering of a bar chart (histogram) for the data that you showed:

ForumPost001.PNG

Notice that you may also need to define which of the columns are to be used in the X and Y axis, which you can do in the Advanced view when selecting the chart:

ForumPost002.PNG

Other chart types (such as a pie chart) would also work the same way.

 

Hope this helps!

View solution in original post

2 REPLIES 2
CarlosFigueira
Power Apps
Power Apps

You can use the GroupBy function to aggregate the data. In your case, if you have a data source with a Severity column, and you want to aggregate on the number of issues with each severity (like in the table below):

ClearCollect(Risks,
    {Severity: 1, Name: "Issue 01"},
    {Severity: 1, Name: "Issue 02"},
    {Severity: 1, Name: "Issue 03"},
    {Severity: 2, Name: "Issue 04"},
    {Severity: 2, Name: "Issue 05"},
    {Severity: 2, Name: "Issue 06"},
    {Severity: 2, Name: "Issue 07"},
    {Severity: 2, Name: "Issue 08"},
    {Severity: 2, Name: "Issue 09"},
    {Severity: 3, Name: "Issue 10"},
    {Severity: 3, Name: "Issue 11"},
    {Severity: 3, Name: "Issue 12"}, ...
 )

Then you can insert a new chart control, and in its Items property, you can group the Risks table by the severity, and add a new column to the group that uses the CountRows function to find out how many issues with a given severity exist:

AddColumns(GroupBy(Risks, "Severity", "BySeverity"), "Count", CountRows(BySeverity))

For example this is the rendering of a bar chart (histogram) for the data that you showed:

ForumPost001.PNG

Notice that you may also need to define which of the columns are to be used in the X and Y axis, which you can do in the Advanced view when selecting the chart:

ForumPost002.PNG

Other chart types (such as a pie chart) would also work the same way.

 

Hope this helps!

View solution in original post

How would you go about filtering the data as well

I've tried using Filter to what you wrote, but I get an "Invalid Argument Type" error

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (17,385)