Group Abstract Group Abstract

Message Boards Message Boards

0
|
1.1K Views
|
8 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How can I sort pivot tables with aggregates?

I can't sort the aggregates of the following pivot table:

a = {    {"Grupo5", 1, 2, 3}, {"Grupo1", 4, 5, 6}, {"Grupo5", 7, 6, 
    7}, {"Grupo2", 8, 9, 10}, {"Grupo2", 8, 9, 10} };
SortBy[  
 PivotTable[  
  Sort[   Tabular[  a , {"grupo", "num 1", "num 2", "num 3"}  ]   ],
  Length[\.08 #["num 1"]] &, "grupo", "num 2", 
  IncludeGroupAggregates -> True],
 #[[1]] &
   ]
Attachments:
8 Replies

Not exactly, my code places the group aggregates at the bottom of the table, granted, as you say, not at the right as you're aiming for. Hopefully someone else can help with that.

Thank you Lewis. Now I see the difference. Very useful.

Ricardo, your passive aggression isn't cool. That aside, what might actually be useful to you is this link: https://www.youtube.com/live/OKN297uHtkc?si=3qPoOxQUhHyizgFq&t=2130 Jon McLoone might have what you're looking for.

Thanks Ricardo.

enter image description here

Thanks Lewis. I think this solves the problem.

enter image description here

I'm not sure if that's what you were looking for, or not.

Thank you Lewis, but the code you sent is exactly the code I wrote with my question. My problem is that I want the column All (the Total) to be in the fire right column (the same as when you do a Pivot table in Excel).

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard