我有一份报告,其中适用多种情况 像100% 75% 和50%
我使用了背景颜色条件
Wattage time_stamp timeOfDay
0 100 2015-02-24 10:00:00 Morning
1 120 2015-02-24 11:00:00 Morning
2 104 2015-02-24 12:00:00 Morning
3 105 2015-02-24 13:00:00 Afternoon
4 109 2015-02-24 14:00:00 Afternoon
5 120 2015-02-24 15:00:00 Afternoon
6 450 2015-02-24 16:00:00 Afternoon
7 200 2015-02-24 17:00:00 Evening
8 300 2015-02-24 18:00:00 Evening
9 190 2015-02-24 19:00:00 Evening
10 100 2015-02-24 20:00:00 Evening
11 110 2015-02-24 21:00:00 Evening
我没有颜色请告诉我我在SSRS中的新功能谢谢
=iif(count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "8" and lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime")
= "100%" ,"Green","Red") and iif(
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value,Fields!SINFO.Value, "FullTime"))>= "6" and lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime")
= "75%" ,"Green","Red") and iif(
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "4" and lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime")
= "50%" ,"Green","Red")
答案 0 :(得分:1)
请尝试使用Switch:
=Switch(
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "8"
and lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime") = "100%",
"Green",
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value,Fields!SINFO.Value, "FullTime"))>= "6"
and lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime") = "75%" ,
"Green",
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "4"
and lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime") = "50%" ,
"Green",
true,"Red"
)
如果您在每个条件中执行的计算具有正确的分组设置,它将起作用。
如果有帮助,请告诉我。
答案 1 :(得分:0)
你让流量以错误的方式落下。为清晰起见,我修改了格式。
=iif(
lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime")= "100%"
and
(
(
IS_SUMMER()
AND
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "8"
)
OR
(
IS_WINTER()
AND
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "4"
)
),
"Green"
,iif(
lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime")= "75%"
and
(
(
IS_SUMMER()
AND
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "6"
)
OR
(
IS_WINTER()
AND
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "3"
)
),
"Green"
,iif(
lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime")= "50%"
and
(
(
IS_SUMMER()
AND
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "6"
)
OR
(
IS_WINTER()
AND
count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"))>= "3"
)
),
"Green"
,"Red"
)
)
)
使用额外字段进行了更新。
此时你可以看到可怕是如何得到的。它很难看,很难维护和重复使用。有两种方法可以清理它。
<强> 1。使用代码中的函数设置颜色 -
textbox1.BackgroundColor=Code!MyFunctionToEvaluate(Percent,Number)
<强> 2。使用计算字段 -
IIF(
Fields!CALCPercent.Value=100 AND
(
(Fields!CALCIsSummer.Value AND Fields!CALCCount=8)
OR
(Fields!CALCIsWinter.Value AND Fields!CALCCount=6)
)
...
)
以下是您可以在“报告”|“选项”|“代码”窗口中添加的功能。
Public Function CalculateColor(percentage As String, count As String, Season As String) AS String
Dim Result As String = "Red"
If(percentage="100%") Then
Result = "Gree"
Else If(percentage="75%") Then
Result = "Gree"
Else If (percentage="50%") Then
Result="Green"
EndIf
return Result
End Function
一旦编译(我没有检查语法),那么你可以将结果分配给文本框的BackgroundColor。
textbox.BackgroundCode=<Expression> =Code.CalculateColor(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime"),count(lookup(Fields!Assessors_Staff_ID.Value,Fields!EMPNO.Value, Fields!SINFO.Value, "FullTime")),GET_SEASON())