Answered by:
How to count the number of items within a given category (group by)

>
Question
-
Hi,
I have a request to count the number of item whin a particular category along with the following conditions:
1. Dose not show the deail items.
2. The count number appears next to the category name
3. The view is sorted by the highest count in decending orderExample:
- Joe = 5
- John = 4
- Tim = 3
- ...
The default list view does not allow me to sort the the highest count. If I convert the dataview to XSLT in SPD, the count would disappear.
Basically, I just want a summary of all the categories (Group By) of a list with the number of item counts next to it and sorted. Not sure if this is possible in SPD to accomplish.
Thanks in advance.
Ultra
UltragcWednesday, May 20, 2009 10:50 PM
Answers
-
Ultra:
I had posted an answer but realized it was incorrect. I just posted a working example to my blog:
http://mdasblog.wordpress.com/2009/05/20/showing-subtotals-in-a-dvwp-sorted-by-the-subtotals/
My example works for the sum, but you can replace each:
sum($Rows[current()/@Title=@Title]/@Amount)
with
count($Rows[current()/@Title=@Title])
to get what you are looking for.
M.
Marc - Sympraxis Consulting LLC - Marc's Blog- Marked as answer by Mike Walsh FIN Thursday, May 21, 2009 6:25 AM
Thursday, May 21, 2009 1:46 AM
All replies
-
Ultra:
I had posted an answer but realized it was incorrect. I just posted a working example to my blog:
http://mdasblog.wordpress.com/2009/05/20/showing-subtotals-in-a-dvwp-sorted-by-the-subtotals/
My example works for the sum, but you can replace each:
sum($Rows[current()/@Title=@Title]/@Amount)
with
count($Rows[current()/@Title=@Title])
to get what you are looking for.
M.
Marc - Sympraxis Consulting LLC - Marc's Blog- Marked as answer by Mike Walsh FIN Thursday, May 21, 2009 6:25 AM
Thursday, May 21, 2009 1:46 AM -
Hey Marc,
Really appreciate your help. Result not showing up as expected. I have posted the questions in your blog.
Thanks
Gene
UltragcThursday, May 21, 2009 3:56 PM -
After some more back and forth with Ultra, I've posted another solution to my blog for Person/Group columns:
http://mdasblog.wordpress.com/2009/05/22/showing-subtotals-in-a-dvwp-sorted-by-the-subtotals-part-2/
M.
Marc - Sympraxis Consulting LLC - Marc's BlogFriday, May 22, 2009 9:32 PM