SQL Server Performance

Running Total Problem

Discussion in 'SQL Server Reporting Services' started by fisab, Oct 3, 2005.

  1. fisab New Member

    Hi there - I hope someone can help me with this problem :

    Suppose I have the following info :

    Group Amt Detail
    --------------------------------------
    A
    1000 1
    1000 2
    1000 3
    B
    2000 4
    2000 5
    2000 6
    ---------------------------------------

    I can get aggregates at group level by using First(Fields!Amt.value) and Sum(Fields!Detail.value) in the group footer.
    But if I want an overall sum of Amt at the table footer, then Sum(Fields!Amt.value) will give me a value of 9000 rather than the 3000 I want.

    How do I get 3000?

    Many thanks in advance for any help.

    SteveB.
  2. ghemant Moderator

    Hi,
    are u looking for this ?!
    From BOL :

    SELECT type, price, advance
    FROM titles
    WHERE type LIKE '%cook'
    ORDER BY type
    COMPUTE SUM(price), SUM(advance) BY type


    Regards

    Hemantgiri S. Goswami
    ghemant@gmail.com
    "Humans don't have Caliber to PASS TIME , Time it self Pass or Fail Humans" - by Hemantgiri Goswami

Share This Page