在单行中显示季度记录的数据

发布于 2024-10-14 01:50:34 字数 202 浏览 0 评论 0原文

每个季度的销售数据包含在数据源的一行中。

帐户 1 的 4 个季度的销售数据将位于 4 个单独的记录中,每个记录包含帐户名称、季度编号和购买的商品数量。

报告应在每个详细信息行中显示:帐户名称、第 1 季度计数、第 2 季度计数、第 3 季度计数、第 4 季度计数、总年份计数。

我是 Crystal 的新手,但这似乎应该很容易;我该怎么做?

Each quarter's sales data is contained in a row in the data source.

Account 1's 4 quarters of sales data would be in 4 separate records, each containing the account name, quarter number, and count of items purchased.

The report should show, in each detail row: account name, q1 count, q2 count, q3 count, q4 count, total year count.

I'm new to Crystal, but it seems like this should be easy; how would I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧城空念 2024-10-21 01:50:34

我可能会使用一些稍微复杂的 sql 创建结果列表,它们只是将其显示在 Crystal 报告上...但是如果您想完全在 Crystal 内完成此操作,请查看 http://aspalliance.com/1041_Creating_a_Crosstab_Report_in_Visual_Studio_2005_Using_Crystal_Reports.all

这是需要的 SQL 的刺探...

select
accountName, 
(select sum(itemCount) from myTable where quarterName = 'q1') as q1Count, 
(select sum(itemCount) from myTable where quarterName = 'q2') as q2Count, 
(select sum(itemCount) from myTable where quarterName = 'q3') as q3Count, 
(select sum(itemCount) from myTable where quarterName = 'q4') as q4Count, 
(select sum(itemCount) from myTable) as yearCount
from myTable  
group by accountName ;

I'd probably create the result list using some slightly complex sql and they just display it on the Crystal report...but if you're wanting to accomplish this entirely inside Crystal, take a look at http://aspalliance.com/1041_Creating_a_Crosstab_Report_in_Visual_Studio_2005_Using_Crystal_Reports.all.

Here's a stab at the SQL that would be required...

select
accountName, 
(select sum(itemCount) from myTable where quarterName = 'q1') as q1Count, 
(select sum(itemCount) from myTable where quarterName = 'q2') as q2Count, 
(select sum(itemCount) from myTable where quarterName = 'q3') as q3Count, 
(select sum(itemCount) from myTable where quarterName = 'q4') as q4Count, 
(select sum(itemCount) from myTable) as yearCount
from myTable  
group by accountName ;
極樂鬼 2024-10-21 01:50:34

如果您的数据源中包含销售日期(我假设它会),您可以创建一个名为 @SalesQuarter 的公式:

if month({TableName.SalesQuarter}) in [1,2,3] then '1' else
if month({TableName.SalesQuarter}) in [4,5,6] then '2' else
if month({TableName.SalesQuarter}) in [7,8,9] then '3'
else '4' 

然后您可以向报告中添加一个交叉表,并使用新的@SalesQuarter 字段作为交叉表的列标题。

这假设您的销售额均在同一年内。

If your data source has the sales date in it (and I assume it would), you can create a formula called @SalesQuarter:

if month({TableName.SalesQuarter}) in [1,2,3] then '1' else
if month({TableName.SalesQuarter}) in [4,5,6] then '2' else
if month({TableName.SalesQuarter}) in [7,8,9] then '3'
else '4' 

You can then add a cross-tab to your report, and use the new @SalesQuarter field as the column header of your cross-tab.

This assumes your sales are all within the same year.

如日中天 2024-10-21 01:50:34

在 {account} 上添加群组
在组页脚中添加每个季度的运行总计。

For each quarter, create a running total with following settings:

  Running Total Name: create a unique name for each formula, for example Q1,Q2,Q3,Q4
  Field to summarize: {items purchased}
  Type of summary: sum
  Evaluate: Use a formula - {quarter number}= --should be 1,2,3, or 4, depending on which quarter you are summing
  Reset: On Change of Group {account}

Add a group on {account}
In the group footer add a Running total for each quarter.

For each quarter, create a running total with following settings:

  Running Total Name: create a unique name for each formula, for example Q1,Q2,Q3,Q4
  Field to summarize: {items purchased}
  Type of summary: sum
  Evaluate: Use a formula - {quarter number}= --should be 1,2,3, or 4, depending on which quarter you are summing
  Reset: On Change of Group {account}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文