简体   繁体   English

SSRS根据组更改行颜色?

[英]SSRS Changing Row Colors Based on Groups?

I have a report in SSRS and I am trying to change the background color based on a group. 我在SSRS中有一个报告,我正在尝试根据组更改背景颜色。 I have 3 groups: YearMonth, Portfolio, and Name. 我有3组:YearMonth,Portfolio和Name。 I want to change the color of every other portfolio group. 我想改变其他所有投资组合的颜色。 Inside each portfolio group I want all rows to be the same color. 在每个投资组合组中,我希望所有行都是相同的颜色。

I have tried the following expressions and it fails when there are odd number of portfolios in a given month, ie I don't want the same colors touching. 我已经尝试了以下表达式,并且当给定月份中存在奇数个投资组合时它会失败,即我不希望相同的颜色触及。

=IIF(RunningValue(Fields!Portfolio.Value, CountDistinct, "MonthYear") Mod 2, "Gainsboro", "White")

The above gets: 以上得到:

YearMonth   Port# (Color)
Sep-11      Port1 (Gainsboro)
            Port2 (White)
Aug-11      Port1 (Gainsboro)
            Port2 (White)
            Port3 (Gainsboro)
Jul-11      Port1 (Gainsboro)

I want: 我想要:

YearMonth   Port# (Color)
Sep-11      Port1 (Gainsboro)
            Port2 (White)
Aug-11      Port1 (Gainsboro)
            Port2 (White)
            Port3 (Gainsboro)
Jul-11      Port1 (White)

To me it would seem that you want it to alternate colors based on group, but have it take into consideration the color of the last line in the prior date. 对我来说,似乎你希望它基于组交替颜色,但要考虑前一日期中最后一行的颜色。

Seeing as how this is the case, why not just select the row itself (that handles the groupings)(far left portion of the yellow box). 看到这是怎么回事,为什么不选择行本身(处理分组)(黄色框的最左边部分)。 You can then select the BackgroundColor property and choose "Expression" 然后,您可以选择BackgroundColor属性并选择“表达式”

在此输入图像描述

You should be able to input something like: 你应该能够输入如下内容:

= IIf(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")

This will get you alternating colors as you have described. 如您所述,这将为您提供交替的颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM