周一至周五 : 08:30 - 17:30 客服专员电话/微信:18049979371 QQ:2982200781
微信咨询

扫码微信咨询

关注公众号

关注微信公众号

电话: 021 5161 9370
返回顶部
一个表间公式计算同比、年累、环比的方法
显示全部楼层 倒序浏览 发表日期 2019-11-05 06:52:41 11862次阅读 15次回复
对于填报的数据统计时需要月度合计,而后月度会和同期月度数据比较,每月也会计算年度累计数据,然后和同期年度累计数据比较,根据本月与上月的数据计算环比的增长及增长率,下面通过一个表间公式来实现,可以简化原来需要多个公式进行行列匹配的写法以及支持应用与WEBAPP。

下面作为示例说明可以先行在SQL查询分析器执行

创建表并插入数据

  1. CREATE TABLE [dbo].[REPORT](
  2.         [NAME] [varchar](50) NULL,
  3.         [DATE] [datetime] NULL,
  4.         [AMOUNT] [numeric](18, 0) NULL
  5. ) ON [PRIMARY]
  6. GO


  7. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-01-01',1)
  8. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-02-01',2)
  9. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-03-01',3)
  10. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-04-01',4)
  11. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-05-01',5)
  12. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-06-01',6)
  13. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-07-01',7)
  14. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-08-01',8)
  15. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-09-01',9)
  16. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-10-01',10)
  17. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-11-01',11)
  18. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-12-01',12)
  19. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-01-01',13)
  20. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-02-01',14)
  21. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-03-01',15)
  22. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-04-01',16)
  23. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-05-01',17)
  24. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-06-01',18)
  25. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-07-01',19)
  26. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-08-01',20)
  27. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-09-01',21)
  28. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-10-01',22)
  29. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-11-01',23)
  30. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-12-01',24)
  31. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-01-02',1)
  32. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-02-02',2)
  33. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-03-02',3)
  34. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-04-02',4)
  35. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-05-02',5)
  36. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-06-02',6)
  37. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-07-02',7)
  38. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-08-02',8)
  39. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-09-02',9)
  40. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-10-02',10)
  41. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-11-02',11)
  42. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2018-12-02',12)
  43. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-01-02',13)
  44. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-02-02',14)
  45. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-03-02',15)
  46. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-04-02',16)
  47. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-05-02',17)
  48. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-06-02',18)
  49. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-07-02',19)
  50. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-08-02',20)
  51. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-09-02',21)
  52. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-10-02',22)
  53. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-11-02',23)
  54. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('E','2019-12-02',24)
  55. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-01-01',1)
  56. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-02-01',2)
  57. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-03-01',3)
  58. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-04-01',4)
  59. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-05-01',5)
  60. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-06-01',6)
  61. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-07-01',7)
  62. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-08-01',8)
  63. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-09-01',9)
  64. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-10-01',10)
  65. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-11-01',11)
  66. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-12-01',12)
  67. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-01-01',13)
  68. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-02-01',14)
  69. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-03-01',15)
  70. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-04-01',16)
  71. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-05-01',17)
  72. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-06-01',18)
  73. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-07-01',19)
  74. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-08-01',20)
  75. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-09-01',21)
  76. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-10-01',22)
  77. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-11-01',23)
  78. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-12-01',24)
  79. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-01-02',1)
  80. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-02-02',2)
  81. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-03-02',3)
  82. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-04-02',4)
  83. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-05-02',5)
  84. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-06-02',6)
  85. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-07-02',7)
  86. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-08-02',8)
  87. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-09-02',9)
  88. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-10-02',10)
  89. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-11-02',11)
  90. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2018-12-02',12)
  91. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-01-02',13)
  92. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-02-02',14)
  93. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-03-02',15)
  94. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-04-02',16)
  95. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-05-02',17)
  96. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-06-02',18)
  97. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-07-02',19)
  98. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-08-02',20)
  99. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-09-02',21)
  100. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-10-02',22)
  101. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-11-02',23)
  102. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('D','2019-12-02',24)
  103. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-01-01',1)
  104. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-02-01',2)
  105. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-03-01',3)
  106. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-04-01',4)
  107. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-05-01',5)
  108. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-06-01',6)
  109. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-07-01',7)
  110. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-08-01',8)
  111. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-09-01',9)
  112. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-10-01',10)
  113. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-11-01',11)
  114. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-12-01',12)
  115. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-01-01',13)
  116. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-02-01',14)
  117. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-03-01',15)
  118. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-04-01',16)
  119. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-05-01',17)
  120. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-06-01',18)
  121. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-07-01',19)
  122. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-08-01',20)
  123. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-09-01',21)
  124. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-10-01',22)
  125. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-11-01',23)
  126. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-12-01',24)
  127. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-01-02',1)
  128. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-02-02',2)
  129. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-03-02',3)
  130. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-04-02',4)
  131. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-05-02',5)
  132. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-06-02',6)
  133. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-07-02',7)
  134. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-08-02',8)
  135. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-09-02',9)
  136. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-10-02',10)
  137. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-11-02',11)
  138. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2018-12-02',12)
  139. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-01-02',13)
  140. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-02-02',14)
  141. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-03-02',15)
  142. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-04-02',16)
  143. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-05-02',17)
  144. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-06-02',18)
  145. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-07-02',19)
  146. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-08-02',20)
  147. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-09-02',21)
  148. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-10-02',22)
  149. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-11-02',23)
  150. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('C','2019-12-02',24)
  151. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-01-01',1)
  152. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-02-01',2)
  153. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-03-01',3)
  154. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-04-01',4)
  155. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-05-01',5)
  156. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-06-01',6)
  157. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-07-01',7)
  158. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-08-01',8)
  159. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-09-01',9)
  160. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-10-01',10)
  161. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-11-01',11)
  162. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-12-01',12)
  163. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-01-01',13)
  164. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-02-01',14)
  165. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-03-01',15)
  166. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-04-01',16)
  167. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-05-01',17)
  168. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-06-01',18)
  169. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-07-01',19)
  170. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-08-01',20)
  171. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-09-01',21)
  172. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-10-01',22)
  173. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-11-01',23)
  174. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-12-01',24)
  175. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-01-02',1)
  176. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-02-02',2)
  177. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-03-02',3)
  178. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-04-02',4)
  179. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-05-02',5)
  180. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-06-02',6)
  181. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-07-02',7)
  182. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-08-02',8)
  183. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-09-02',9)
  184. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-10-02',10)
  185. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-11-02',11)
  186. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2018-12-02',12)
  187. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-01-02',13)
  188. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-02-02',14)
  189. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-03-02',15)
  190. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-04-02',16)
  191. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-05-02',17)
  192. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-06-02',18)
  193. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-07-02',19)
  194. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-08-02',20)
  195. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-09-02',21)
  196. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-10-02',22)
  197. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-11-02',23)
  198. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('B','2019-12-02',24)
  199. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-01-01',1)
  200. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-02-01',2)
  201. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-03-01',3)
  202. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-04-01',4)
  203. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-05-01',5)
  204. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-06-01',6)
  205. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-07-01',7)
  206. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-08-01',8)
  207. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-09-01',9)
  208. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-10-01',10)
  209. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-11-01',11)
  210. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-12-01',12)
  211. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-01-01',13)
  212. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-02-01',14)
  213. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-03-01',15)
  214. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-04-01',16)
  215. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-05-01',17)
  216. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-06-01',18)
  217. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-07-01',19)
  218. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-08-01',20)
  219. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-09-01',21)
  220. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-10-01',22)
  221. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-11-01',23)
  222. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-12-01',24)
  223. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-01-02',1)
  224. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-02-02',2)
  225. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-03-02',3)
  226. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-04-02',4)
  227. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-05-02',5)
  228. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-06-02',6)
  229. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-07-02',7)
  230. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-08-02',8)
  231. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-09-02',9)
  232. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-10-02',10)
  233. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-11-02',11)
  234. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2018-12-02',12)
  235. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-01-02',13)
  236. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-02-02',14)
  237. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-03-02',15)
  238. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-04-02',16)
  239. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-05-02',17)
  240. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-06-02',18)
  241. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-07-02',19)
  242. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-08-02',20)
  243. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-09-02',21)
  244. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-10-02',22)
  245. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-11-02',23)
  246. INSERT INTO [dbo].[REPORT] ([NAME],[DATE],[AMOUNT]) VALUES ('A','2019-12-02',24)
复制代码



计算得到结果    回帖后可见
游客,如果您要查看本帖隐藏内容请回复


得到的结果

20191105065133.png
电话/微信:18049989370 QQ:857188287
1111111111111111111111111111111111
QQ:2136567674
学习一下,看看是怎样操作的
很好
     
※MVP※

2020-4-24 17:18:53

来学习,学习
258998357

2020-6-17 14:19:57

学习一下,哈哈
这个厉害了,我学习下。
xzlzl

2020-8-28 11:42:41

不知具体如何操作,高大上!
学习一下,大佬加油
dehuizhi

2020-12-14 10:54:21

RE: 一个表间公式计算同比、年累、环比的方法 [修改]

精彩评论15

1111111111111111111111111111111111
QQ:2136567674
学习一下,看看是怎样操作的
很好
     
※MVP※

2020-4-24 17:18:53

来学习,学习
258998357

2020-6-17 14:19:57

学习一下,哈哈
这个厉害了,我学习下。
xzlzl

2020-8-28 11:42:41

不知具体如何操作,高大上!
学习一下,大佬加油
dehuizhi

2020-12-14 10:54:21

RE: 一个表间公式计算同比、年累、环比的方法 [修改]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则  允许回帖邮件提醒楼主

快表软件是国内较早研究表格类软件开发平台的团队之一,迄今已有十多年的行业经验.致力于为企事业单位提供实用可靠的数字化平台。
  • 微信公众号

  • 微信小商店

  • 微信客服

  • Powered by Discuz! X3.4 | Copyright © 2022-2024, XiRong Soft. | 快表软件
  • 沪ICP备13033196号 | 营业执照 |上海西戎软件科技有限公司|沪公网安备31011502002146号|沪ICP备13033196号 |