|
papershop
Starting Member
27 Posts |
Posted - 2011-08-15 : 03:06:28
|
Dear all i have a pivot table like thisselect line, familyname, isnull([1],0) as Jan ,isnull([2],0) as Feb ,isnull([3],0) as Mar,isnull([1],0)+isnull([2],0)+isnull([3],0) as Q1, isnull([4],0) as Apr, isnull([5],0) as Mei, isnull([6],0) as Jun, isnull([4],0)+isnull([5],0)+isnull([6],0) as Q2,isnull([7],0) as Jul,isnull( ,0) as Aug,isnull([9],0) as Sep,isnull([7],0)+isnull( ,0)+isnull([9],0) as Q3, isnull([10],0) as Okt, isnull([11],0) as Nov, isnull([12],0) as Dec, isnull([10],0)+isnull([11],0)+isnull([12],0) as Q4from (select line, _month, familyname, valuenet from dbo.v_fact_salesWHERE (_Year = @year))uppivot (sum(valuenet) for _month in ([1],[2],[3],[4],[5],[6],[7], ,[9],[10],[11],[12]) )as pvtorder by lineand the data that shows are like thiscode product jan feb marAI LAS 100 50 25AI CEF 75 25 25AI CLA 25 255 252C1 APR 458 255 366C1 IRV 114 5144 411what should i do if i want to add a sub total in that data? show the data wouldbe like this :code product jan feb marAI LAS 100 50 25AI CEF 75 25 25AI CLA 25 255 252sub total 200 330 302C1 APR 458 255 366C1 IRV 114 5144 411sub total 572 5399 777help me please@papershop |
|