Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Column and Row Total Expand / Collapse
Author
Message
Posted Monday, January 18, 2010 6:45 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, June 6, 2012 2:50 AM
Points: 19, Visits: 47
I need to calculate row and column totals. I am selecting the report from one view. In that view days are across those dates are getting dynamically.

This view will get updated every day and every day new column(current date as new column) will be added to the report

Please some one suggest me to add the row and column totals for that view.

Thanks
Post #849124
Posted Monday, January 18, 2010 7:07 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:00 PM
Points: 42,301, Visits: 35,356
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.
http://www.sqlservercentral.com/articles/Best+Practices/61537/



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #849139
Posted Monday, January 18, 2010 1:08 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 10:16 AM
Points: 7,010, Visits: 12,869
I'd talk to the folks that are responsible for the script that adds the column each day to give me another column [row_total] that would add all previous columns. If they do it using DynamicCrossTab it'll be an easy task for them to do.
To get the column totals use sum() or, if needed together with the row results, look into WITH ROLLUP operator.

If you need more info than that, please read the first link in my signature (it'll link you to the same article Gail has been pointing at...)




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #849351
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse