[英]grouping data for a pie chart in SSRS
我有一个数据集,可用于在ssrs中构建饼图:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
<entity name="account">
<attribute name="bio_employeesworldwide" alias="TotalWorldWideEmployees" aggregate="sum" />
<filter>
<condition attribute="customertypecode" operator="eq" value="2" />
</filter>
<link-entity name="contact" from="parentcustomerid" to="accountid" alias="contact">
<attribute name="bio_webuseraccountstatus" alias="count_bio_webuseraccountstatus" aggregate="countcolumn" />
<attribute name="bio_webuseraccountstatus" alias="bio_webuseraccountstatusgroupby" groupby="true" />
</link-entity>
</entity>
</fetch>
我只想在此饼图中有2个区域。 一个区域应该全部处于活动状态,而另一区域应该是所有!="Active"
或在sql中描述为:
Case When "Active" then "Active" else "NotActive".
如何使用SSRS完成此操作?
我一直在尝试使用该系列的组表达式来做到这一点:
我究竟做错了什么? 如何获得2个阴影区域?
在尝试下面的IIF建议之后,我得到的输入字符串不是公认的格式:
按照凯尔(Kyle)的建议,我将公式更改为:
=
IIf(Not (IsNothing(Fields!bio_webuseraccountstatusgroupbyValue.Value)
OR Fields!bio_webuseraccountstatusgroupbyValue.Value="")
,"Active"
, "InActive")
而我现在得到的结果仍然是那个愚蠢的错误消息:
另一个失败的尝试:
=iif(NOT IsNothing(Fields!bio_webuseraccountstatusgroupbyValue.Value),
Switch(Fields!bio_webuseraccountstatusgroupbyValue.Value<>"InActive"
AND Fields!bio_webuseraccountstatusgroupbyValue.Value<>"Active",
"InActive", "Active")
,"InActive")
有趣的是,这次只有一个错误:
我错误地使用了一个字符串值而不是数字,所以现在是这样:
=IIF(NOT IsNothing(Fields!bio_webuseraccountstatusgroupbyValue.Value),
SWITCH(Fields!bio_webuseraccountstatusgroupbyValue.Value <> 1
AND Fields!bio_webuseraccountstatusgroupbyValue.Value<>3,
1,
True, 3
),1)
现在我没有任何错误,只是一个不正确的饼图:
您需要一个IIf表达式:
=IIf(Fields!bio_webuseraccountstatusgroupbyValue.Value = "Active", "Active", "NotActive")
您还需要将此设置为SeriesGroup的Label属性。
最终表达式中的语法不正确,您在SWITCH
语句的最后一条语句中缺少True
部分。
尽管逻辑在我看来并不正确,但这种表达方式是正确的。
如果该字段为NULL
,则值将是无效的,否则如果该字段DOES NOT
等于无效AND
DOES NOT
等于活动状态,那么值将是无效的,否则它是积极的。
=IIF(NOT IsNothing(Fields!bio_webuseraccountstatusgroupbyValue.Value),
SWITCH(Fields!bio_webuseraccountstatusgroupbyValue.Value <> "InActive"
AND Fields!bio_webuseraccountstatusgroupbyValue.Value<>"Active",
"InActive",
True, "Active"
),"InActive")
或者,对包含数字值的“值”列使用以下表达式:
=IIF(Fields!bio_webuseraccountstatusgroupbyValue.Value = 3, 3, 1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.