我在SSRS 2014中进行了自我培训。我有一套特定的数据,我想表达一下:我们有一个筹款目标,并有资金实现这一目标。进入的钱落入四个不同的桶中之一 - 所以我正在寻找一些堆积但水平(一个条)的东西,它们显示了总数,然后是一些“空白”空间代表我们需要达到目标。我已经尝试过线性测量仪(无法弄清楚如何显示“划分”部分,即使是数据组也是如此);数据栏(无法正确显示标签,因为它们必须显示在栏内);其他表示会导致多个条形,这是我不想要的。
我一直在研究和尝试两天......我想知道这件看起来如此简单的事实上是否在SSRS中不是特别可行,或者我是否只选择了糟糕的方法。表示这些数据的最佳方式是什么?谢谢!
答案 0 :(得分:0)
您是否尝试过使用表格向导。如果你点击表格向导,你可以选择要炒作的字段,以及你想要分组哪些" Bucket"它属于。只需将您的值拖放到值框中,然后将您的存储桶拖放到行组框中,然后按照向导进行操作即可创建它。
答案 1 :(得分:0)
我相信你最好的选择是简单的条形图。在我看来,这里的关键是让酒吧的价值由收集的目标的百分比来表示。但是,您希望每个柱的标签是到目前为止收集的实际金额。这样,您的酒吧在接近目标时会按比例增长,但标签会显示收集的金额。
或者,您可以创建一个包含完成百分比作为数据条的Tablix,并显示到目前为止收集的数量与目标的对比。
包含样本的屏幕截图。请注意以下事项:
我在查询中硬编码了颜色的名称。这是控制图表外观和感觉的好方法。然后,您只需更改颜色以表示等于颜色字段值的表达式。对于不同的浅色和深色,您还可以设置字体颜色,因此如果您有浅蓝色条,则可以使用黑色文本而不是白色,反之亦然。
在条形图上使用标签时,您需要以条形码的最小值编码。这将确保当你有5个目标(一个相对较小的栏)但是数量很大(124,243美元)的第5个桶时,该栏将调整到足够大以容纳标签。在这种情况下,如果收集的百分比小于15%,那么条形尺寸将为15%。
如果您有任何疑问,请发表评论,我会尽力提供帮助。我用来生成数据集的查询如下。
With CTE as (
Select 'Bucket 1' as bucket, 'blue' as color, 'white' as text_color, 50 as percent_total, 15236 as amount Union all
Select 'Bucket 2' as bucket, 'red' as color, 'white' as text_color, 33 as percent_total, 24685 as amount Union all
Select 'Bucket 3' as bucket, 'green' as color, 'black' as text_color, 67 as percent_total, 41457 as amount Union all
Select 'Bucket 4' as bucket, 'purple' as color, 'white' as text_color, 95 as percent_total, 32493 as amount Union all
Select 'Bucket 5' as bucket, 'black' as color, 'white' as text_color, 5 as percent_total, 124243 as amount
)
Select CTE.*
, CAST(amount as float) / (CAST(percent_total as float) / 100.00) as Goal
From CTE
Order by Bucket desc
根据评论进行编辑
如果你想让剩下的所有桶都放在一个条上,那么你可以通过以下方法实现这一点(尽管我不知道你将如何处理标记各个桶的数量)。
最终结果
查询
Declare @Goal int = 500000;
With CTE as (
Select 'Bucket 5' as bucket, 'blue' as color, 'white' as text_color, 15236 as amount Union all
Select 'Bucket 4' as bucket, 'red' as color, 'white' as text_color, 24685 as amount Union all
Select 'Bucket 2' as bucket, 'green' as color, 'black' as text_color, 41457 as amount Union all
Select 'Bucket 3' as bucket, 'purple' as color, 'white' as text_color, 32493 as amount Union all
Select 'Bucket 1' as bucket, 'black' as color, 'white' as text_color, 124243 as amount
)
Select CTE.bucket
, CTE.color
, CTE.text_color
, CTE.amount
, CAST(CTE.amount as float) / CAST(@Goal as float) as percent_total
, 'white' as border_color
From CTE
Union All
Select 'Remaining' as bucket
, 'Transparent' as color
, 'Transparent' as text_color
, @Goal - SUM(CTE.amount) as amount
, CAST(@Goal - SUM(CTE.amount) as float) / CAST(@Goal as float) as percent_total
, 'black' as border_color
From CTE
Order by Bucket
报表生成器中的设置
请注意,我已将动态更改边框颜色为:
=Fields!border_color.value
并且栏的颜色为:
=Fields!color.value