Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am working in SharePoint 2010. I need to make a chart to represent how many projects we have from each division. We have a SharePoint list of our projects with a choice column of all the divisions.

What I need is a way to count how many of each choice there is and put this into another webpart/list that the chart web part can read in to display as a pie chart. I understand they could be counted manually but I'd like to automate it if possible so up to date information is always present.

If I were to do a calculated column that outputs a 1, 100, 10000, 1000000,... for the row based on division, I could then do some funky math with mods and remainders on the total of that to figure out how many of each but I need to know if there is any way to access that total item. Would javascript/jQuery be able to find that number?

The source code for the area that holds the column total with the closest searchable class name looks like:

<td class="ms-vb2">
    <nobr>
        <b>Sum= 102,040,102</b>
    </nobr>
</td>

Are <nobr> tags very rare in SharePoint sites? Could I do a search for all ms-vb2 and would I have a high chance of only finding one ms-vb2 with a <nobr> tag in it? Any ways to finish off this idea or any better ideas would be great. Thanks in advance for any advice.

share|improve this question
    
A cheeky plug for a commercial product that does exactly this pentalogic.net/sharepoint-products/pivotpoint –  Ryan Dec 1 '11 at 15:52
    
@Ryan cough declaration cough –  Stuart Pegg Dec 1 '11 at 16:25
add comment

2 Answers

up vote 2 down vote accepted

A calculated column only works with the current item, it won't allow you to count.

Out of the box, I see two ways to do this.

The first one, as indicated by Lori, is to create a view grouped by division.

A more standard approach - but it might be too late in your case - is to store the divisions in a list, and in your projects list have a lookup column instead of a choice column. Once you do this, the division list offers a reverse lookup column that gives you the number of projects.

The second approach is more usual because it is more flexible, in case you need to add/remove divisions or change their name.

share|improve this answer
    
That worked. Never knew about that functionality. Thanks a lot Christophe –  Michael Dec 1 '11 at 14:21
add comment

Why not just do a view and total the numbers of the views? That would save you a lot of calculations. You'd have a view for each division. Then you could create list view web parts that just listed the totals, or even dataview web parts that you could perform those calculations with and format in a way that makes sense for your needs.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.