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

Chart

So I have a library in SharePoint, about 13 entries for now.

I am trying to chart how many times each person submitted an entry.

one of the contributors might submit 4 entries and another only 1.

I need to create a column chart to graph their contributions.

so for an example:

ID                          Contributor                              Contribution

1                            RoyGad                                    money

2                            RoyGad                                    Support

3                            Joe                                           money

4                            mike                                         ride

5                            mike                                         books

6                            steve                                        network

7                            Joe                                           snakes

8                            RoyGad                                    drinks

 

 

first step i need to create a collection of the distinct names (each contributor is an object with displayname, email, address,...)

then in the second column how many times the name occured in the library.

then graph the result.

This is the last challenge in my project. I would apprecite all the help. I have been trying for 2 days.

1 ACCEPTED SOLUTION

Accepted Solutions

@RoyGad 

I totally missed that it was a Person data type.  Here's the code segment that needs correcting.  I also corrected it above in the full solution.  Make sure to delete/readd the chart after modifying the code.

 

ClearCollect(myContributors,
    Distinct(AddColumns(myCampaign"FullName",Contributor.DisplayName),FullName))
);

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
Super User III
Super User III

@RoyGad 

Assuming your datasource looks like this

 

ClearCollect(myCampaign,
    {ID:1, Contributor: RoyGad, Contribution: "money"},
    {ID:2, Contributor: RoyGad", Contribution: "Support"},
    {ID:3, Contributor: Joe, Contribution: "money"},
    {ID:4, Contributor: mike, Contribution: "ride"},
    {ID:5, Contributor: mike, Contribution: "books"},
    {ID:6, Contributor: steve, Contribution: "network"},
    {ID:7, Contributor: Joe, Contribution: "snakes"},
    {ID:8, Contributor: RoyGad, Contribution: "drinks"}
);

 

 

We need to do a few further operations to get the 2 columns necessary for the Table: Contributor and Count

 

ClearCollect(myContributors,
    Distinct(AddColumns(myCampaign"FullName",Contributor.DisplayName),FullName))
);
ClearCollect(
    myChart,AddColumns(myContributors,"Count",CountRows(Filter(myCampaign,Contributor=Result)))
);

 

 

Then create a new Bar Chart with these properties

 

Items: myChart
//these are advanced settings
Labels: Contributor
Series1: Count

 

 

Your bar chart will look like this

Capture.PNG

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney 

Thank you so much mdevaney. I can use the rest of the solution.

but I can't get over the distinct function. I can return all the names in the library as the column is a Person/Group

so what returns is a collection of objects not text.

here is what I tried to do

 

ClearCollect(names, Ideas.Contributor)

CountRows(names)    ==> 13   (Correct)

CountRows(Distinct(names, Contributor))    ==> 1    (Wrong)

 

Thank you

Roy

 

 

 

@RoyGad 

I totally missed that it was a Person data type.  Here's the code segment that needs correcting.  I also corrected it above in the full solution.  Make sure to delete/readd the chart after modifying the code.

 

ClearCollect(myContributors,
    Distinct(AddColumns(myCampaign"FullName",Contributor.DisplayName),FullName))
);

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

with some slight modification

 

ClearCollect(myCampaign, Ideas.Contributor); ClearCollect(myContributors,Distinct(myCampaign,Contributor.DisplayName));ClearCollect(
myChart,AddColumns(myContributors,"Count",CountRows(Filter(myCampaign,Contributor.DisplayName = Result))));Navigate(Analysis)

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,478)