每个交叉表组的小计与总计?
我有表单中的查询结果
EmpId Profit OrderID CompanyName
------ ------ ------- --------------
1 500 $ 1 Acme Company
1 200 $ 1 Evolve Corp.
2 400 $ 1 Acme Company
2 100 $ 1 Evolve Corp.
3 500 $ 1 Acme Company
3 500 $ 1 Evolve Corp.
现在,所需的报告格式是
EmpId OrderId Acme's Profit Evolve's Profit
----- ------ ------------- ---------------
1 1 700 $ 700 $
Total ---- ----- ------
700$ 700$
2 1 500 $ 500 $
Total ---- ----- ------
500$ 500$
3 3 1000 $ 1000 $
Total ---- ----- ------
1000$ 1000$
----- ---- ---------- ----------
GrandTotal 2200 $ 2200 $
我在交叉表中努力尝试的,但我无法弄清楚如何对记录进行分组。我尝试在 CrossTab 列中移动 CompanyName,并在行和行中移动 EmpId。尝试了交叉表组,但结果不符合预期。
我的问题是 1)这种格式可以通过交叉表实现吗? 2) 如何在交叉表中按 EmpId 对记录进行分组,以使公司水平移动?
编辑: 我还需要小计和总场。
I have result of query in form
EmpId Profit OrderID CompanyName
------ ------ ------- --------------
1 500 $ 1 Acme Company
1 200 $ 1 Evolve Corp.
2 400 $ 1 Acme Company
2 100 $ 1 Evolve Corp.
3 500 $ 1 Acme Company
3 500 $ 1 Evolve Corp.
Now the desired report format is
EmpId OrderId Acme's Profit Evolve's Profit
----- ------ ------------- ---------------
1 1 700 $ 700 $
Total ---- ----- ------
700$ 700$
2 1 500 $ 500 $
Total ---- ----- ------
500$ 500$
3 3 1000 $ 1000 $
Total ---- ----- ------
1000$ 1000$
----- ---- ---------- ----------
GrandTotal 2200 $ 2200 $
I tried hard at the crosstab but I'm unable to figure out how to group the records. I tried moving CompanyName in CrossTab columns and moved EmpId in rows & tried a cross tab group but results are not as expected.
My questions are
1) Is this format achievable with a cross tab ?
2) How do I group record's by EmpId's in my crosstab in such a way that the Companies are moved horizontally ?
Edit:
I also need sub totals & grand total field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将公司放入专栏部分,然后就可以开始了。
Put the company in the columns section and you're good to go.