I can't help very much because I don't understand what you want. I haven't tried running the code, but you imply that it isn't giving you what you want and I don't understand what it is you DO want. I have spent some time looking at the data given at the top and the desired output at the end and I haven't a clue how the one is supposed to map to the other. Some of the questions I have are:

Are users other than root supposed to be ignored?

If not, where did the data go to?

If so, where did the data come from?

Where did "Aantal" come from?

Your answer may be to use data tables instead of pivot tables. This is a little known technique that goes back to Lotus 1a for DOS and possibly further. If you are doing anything like what I think, my pseudocode would be as follows:

Import the CSV Extract the unique users and dates using the database functions Calculate the lowest and highest dates Paste the users to the destination (leftmost output) column Assign all dates from lowest to highest to the destination (uppermost +output) row Enter the DSUM formula in the top left output cell Create a data table including an extra row and column Label the extra row & column "Total"

Now, there are all sorts of powerful tricks you can perform using named ranges to deal with changing data, but I would advise you to get a simple version working first.

Regards,

John Davies


In reply to Re: win32::ole pivot sort descending by davies
in thread win32::ole pivot sort descending by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.