Group Abstract Group Abstract

Message Boards Message Boards

0
|
358 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.

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.

Apologies Lewis. I truly appreciate the time you spent checking my code and suggesting improvements. For me it's very useful to have different ways of approaching a problem. It is useful to know how I can sort in different ways. Your suggestions may not be a direct solution to the specific problem of aggregates in a pivot table, but they are useful in the use of other functions. Interacting with other members of the Wolfram Community is invaluable to me.

Thank you for sharing the video. I still haven`t finished watching it in detail, but I will, as soon as I have a chance, and will comment,

Thanks Ricardo.

enter image description here

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