Subtotals with out Grand Total

(7 posts) (3 voices)

Tags:

No tags yet.

  1. Hi,

    I'm just starting to research this and I suspect its not possible, but will give it a try anyway.

    I have a column on which I am calculating percentage within a subtotal group. So in my case a group has a total value with several values summed to get that total. There are 4 or 5 of these groups. I've created a query that gets the total for each group and is used to calculate percentage. I'm using 'dbr.sum' to get a "subtotal" of 100% for each group from the percentage calculation, however at the end I also get a number which is n * 100% where "n" is the number of groups that were subtotaled. This number is meaningless and I don't want to display it. Is there a way to not show it, or might there be another way to show the percentage total of these subtotals, without displaying a Grand Total.

    Making this harder is that I would still like the Total of the group sums at the end.

  2. myDBR Team, Key Master

    The total sum is automatically calculated since you requested for it. There is no option to say that just calculate the subtotals but not the grand total.

    But If you really do not want to display the grand total, you can remove it with small javascipt.

    select 'dbr.javascript', "$('#dbr_rt1 tr:last td:nth-child(2)').text('');"

    where dbr_rt1 is the resultset in the query and 2 is the column you wish to clear.

    --
    myDBR Team

  3. Thanks for this...it looks very promising.

    $ is clear after some research, but still not sure about "#". Is that a requirement of result specification or more a standard way to implement.

  4. myDBR Team, Key Master

    It's a jQuery reference. See http://api.jquery.com/category/selectors/

    '#dbr_rt1' is an ID of the first report object. # means that 'dbr_rt1' is the ID of the object.
    'tr:last' refers to last row in the table.
    'td:nth-child(2)' refers to second column in the last row.
    ".text('')" empties the cell.

    So "take first resultset's last row and empty row's 2nd column's cell".

    --
    myDBR Team

  5. JMitchell, Member

    This fix isn't working for me.

    My report is called sp_DBR_test2

    So I tried:

    select 'dbr.javascript', "$('#sp_DBR_test2 tr:last td:nth-child(5)').text('')";
    and
    select 'dbr.javascript', "$('#dbr_rt1 tr:last td:nth-child(5)').text('')";

    My 5th Grand Total cell still shows values. I am using a crosstab query to pull my result set with a few dbr.sum and dbr.summarycalc. Also, I haven't used any of the Java Script features yet.

  6. myDBR Team, Key Master

    Most likely your object's order number (and therefore the ID) is different.

    To hide the summary line so that you do now need to care about the ID, you can add a class name for the object and then use javascript to refer to this class.

    Attach the a class to the object by issuing following command before the actual query:

    select 'dbr.resultclass', 'hide_summary';

    And issue following command at the end of the report:

    select 'dbr.javascript', "$('.hide_summary tr:last td').text('');", 'onload';

    This means that find all objects with css class hide_summary and empty all cells at in last row.

    --
    myDBR Team

  7. JMitchell, Member

    excellent! This worked. I appreciate it.


Reply

You must log in to post.