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

Bar Graph from Sharepoint for two columns and sum of total.

I have a sharepoint list called 'Expense' with ~20 columns. Among them i am trying to create a bar graph using "Category" and "Total Amount".. 

i need to group "Category" like bills, travel... etc

Sum of group of category....

in a bar graph...

I tried multiple solutions here in community but failed... Can someone help please
Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hey @HKumar6 

 

Can you try to use the below expression on the Items property of your graph?

AddColumns(GroupBy(SPListName,"Category","Grouped"),"TotalCount", Sum(Grouped, TotalAmount))

Then, you can use Category and TotalCount in the graph series and labels.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
JesperHuang
Helper I
Helper I

Hi @HKumar6 ,

 

Is this what you want?

example1.png

 

Here is the code i put in Onselect event:

ClearCollect( Expense, 
    { Category: "Learn", Price: 8615000}, 
    { Category: "Bills",        Price: 3562000}, 
    { Category: "Travel",          Price: 3165000}, 
    { Category: "Books",          Price: 2874000}, 
    { Category: "Learn",         Price: 2273000}, 
    { Category: "Bills",        Price: 1760000}, 
    { Category: "Travel",          Price: 1602000}, 
    { Category: "Bills",        Price: 1494000}, 
    { Category: "Books",          Price: 1344000}
);
ClearCollect(GroupExpense, GroupBy(Expense,"Category","Prices"));
ClearCollect(SumByCate, AddColumns(GroupExpense, "Total Amount", Sum(Prices,Price)));

 

Hey @HKumar6 

 

Can you try to use the below expression on the Items property of your graph?

AddColumns(GroupBy(SPListName,"Category","Grouped"),"TotalCount", Sum(Grouped, TotalAmount))

Then, you can use Category and TotalCount in the graph series and labels.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

But i do not want to define the category in Powerapps since its going to be a dynamic values... Some categories will be added later in the stage. how to do without defining categories manually in powerapps? 

Thank you so much... this perfectly worked 🙂
I am so glad to learn how to make bar graph now.

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

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (37,183)