SSRS:如何在组标题中显示总数的百分比
我有一份报告,显示过去 3 个月按销售代表按客户部门分组的客户预约。在“客户部门”组标题中,我想显示约会所代表的该部门客户总数的百分比。
例如,我的报告显示过去 3 个月内 John Smith 为“国防”部门的客户进行了 6 次预约。 John Smith 还为“地方政府”部门的客户进行了 4 次预约。
我知道我共有 10 个国防客户和 20 个地方政府客户。如何显示过去三个月内该领域的客户百分比?
所以我目前展示:
Sales Rep: John Smith (10 appointments)
Sector: Defence (2 customers)
Customer 1 (4 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Appointment 4 -- Blah
Customer 2 (2 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Sector: Local Government (2 customers)
Customer 3 (3 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Customer 4 (1 appointment)
Appointment 1 -- Blah
我想展示:
Sales Rep: John Smith (10 appointments)
Sector: Defence (2 customers - **20% of total Defence customers**)
Customer 1 (4 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Appointment 4 -- Blah
Customer 2 (2 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Sector: Local Government (2 customers - **10% of Local Government customers**)
Customer 3 (3 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Customer 4 (1 appointment)
Appointment 1 -- Blah
我是 SSRS 菜鸟,所以不知道如何实现这一点。我是否需要向报告中添加包含每个客户部门的客户总数的数据集?
如果我这样做,我如何使用客户部门组标题中当前显示的表达式中的国防总数来计算出该部门中看到的客户总数的百分比?
由于数据库限制,我无法在源数据库中创建任何表、视图或存储过程,因此所有工作都必须在报表中完成。
我正在使用 SSRS 2005。
非常感谢!
I have a report that shows customer appointments, by sales rep for the past 3 months grouped by customer sector. In the Customer Sector group header, I want to show the percentage of the overall total of customers in this sector that the appointments represent.
For example, my report shows that 6 appointments were made by John Smith for customers in the 'Defence' sector in the past 3 months. John Smith also made 4 appointments for customers in the 'Local Government' sector.
I know that I have a total of 10 Defence customers and 20 Local Government customers. How can I show the percentage of customers seen in that sector in the past three months?
So I currently show:
Sales Rep: John Smith (10 appointments)
Sector: Defence (2 customers)
Customer 1 (4 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Appointment 4 -- Blah
Customer 2 (2 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Sector: Local Government (2 customers)
Customer 3 (3 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Customer 4 (1 appointment)
Appointment 1 -- Blah
And I want to show:
Sales Rep: John Smith (10 appointments)
Sector: Defence (2 customers - **20% of total Defence customers**)
Customer 1 (4 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Appointment 4 -- Blah
Customer 2 (2 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Sector: Local Government (2 customers - **10% of Local Government customers**)
Customer 3 (3 appointments)
Appointment 1 -- Blah
Appointment 2 -- Blah
Appointment 3 -- Blah
Customer 4 (1 appointment)
Appointment 1 -- Blah
I'm a SSRS noob, so don't know how I can achieve this. Do I add a dataset to the report that has the total number of customers in each customer sector?
If I do that, how can I use the total for say, Defence, in the expression I currently show in the Customer Sector group header to work out the percentage of total customers seen in that sector?
Due to database restrictions, I can't create any tables, views or stored procs in the source database, so all the work has to be done in the report.
I'm using SSRS 2005.
Many thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您想要完成的事情可能最容易通过在当前数据的 SQL 查询中添加 %customers 作为列来完成。这取决于您现在拥有多少数据集。如果您发布数据集的 SQL,我很乐意提供建议;没有它我就不得不猜测。这可能足够接近,足以引导您走上正确的道路。
如果您将上面的数据提取到以下形式的大非规范化结果中:
我确信这不是最佳解决方案,但它会起作用。
I think what you want to accomplish is probably done most easily by adding %customers as a column in your SQL query for the current data. It depends on how many datasets you have right now. If you post your SQL for your datasets I'd be happy to advise; without it I'm going to have to guess. This is probably close enough to lead you on the right path.
If you have the data above being pulled into a big denormalized result of the form:
I'm sure this is not the optimal solution but it will work.