cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RoyGad
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
mdevaney
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."

RoyGad
Frequent Visitor

@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

RoyGad
Frequent Visitor

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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 (44,793)