SSRS 表达式 - 基于 Dense Rank 函数的交替行颜色

SSRS Expression - Alternate Row Color Based on Dense Rank function

我有一份 SSRS 报告,其中我一直在使用标准表达式来交替显示行颜色:

=IIF(RowNumber(Nothing) Mod 2 = 0, "LightGrey", "White")

但是这个特定的报告显示客户有重复的 SSN,所以我添加了一个 DENSE_RANK windows 函数,这样每个 SSN 都会被分配相同的 DENSE_RANK 值 - 我希望这会允许我将行颜色基于 DENSE_RANK 而不是简单的交替行颜色表达式。

例如,

CustomerID : 1, SSN : 123456789, DENSE_RANK : 1

CustomerID : 2, SSN : 123456789, DENSE_RANK : 1

CustomerID : 3, SSN : 987654321, DENSE_RANK : 2

在报告中,我的目标是将 DENSE_RANK 1 个值设置为一种颜色,而 DENSE_RANK 2 个值设置为另一种颜色 - 显然,对于尽可能多的重复 SSN,这将继续就像在报告中一样。我试着修改原来的表达式如下:

=IIF(RowNumber(Fields!SSNRanking.Value) Mod 2 = 0, "LightGrey", "White")

SSNRanking 是我给 DENSE_RANK 函数的别名,当我尝试预览报告时收到以下错误消息:

The Background Color expression for the text box "CustomerID" has a scope parameter that is not valid for an aggregate function. The scope parameter much be set to a string constant that is equal to either the name of the containing group, the name of a containing data region, or the name of a dataset.

有没有办法构建表达式来实现我的目标?

谢谢,

你不能删除 Rownumber 和 mod 字段!SSNRanking.Value?