SSRS 中一列中特定十进制值的计数 Table

Count of specific decimal values in a column in SSRS Table

我正在尝试获取特定年龄段人群的总和。 AgeInYears 是小数。

我试过求和每次都是0

=SUM(IIF( Fields!AgeInYears.Value = 15, 1, 0 ) )

如果我进行计数,我会得到 68,这仍然不正确

=Count(IIF( Fields!AgeInYears.Value = 15, 1, 0 ) )

我不确定我是否正确地与小数进行了比较。当我在 SQL 中使用我的查询时,然后在数据上使用一个枢轴 table 我能够找到 47 的答案(我使用 excel 比 SSRS 好得多)。但是在 SSRS 中我只能得到 0 或 68 值。

编辑 我正在通过

在我的查询中自己计算 AgeInYears
cast(cast(datediff(month, invl.ChildDateOfBirth, fp.enddate) as decimal) / 12 as decimal) as AgeInYears

这有关系吗?

当我试图计算年龄时,我无法解决 SSRS 给我的任何问题。

我已将查询更新为

Select
    cast(cast(datediff(month, invl.ChildDateOfBirth, fp.enddate) as decimal) / 12 as decimal) as AgeInYears
From Table
Where
    cast(cast(datediff(month, invl.ChildDateOfBirth, fp.enddate) as decimal) / 12 as decimal) > 13 
and 
    cast(cast(datediff(month, invl.ChildDateOfBirth, fp.enddate) as decimal) / 12 as decimal) as AgeInYears < 19

这确保我的数据只包含我想要的年龄(14-18 岁之间。 然后在 SSRS table 中,我在 AgeInYears 上创建了一个行组并做了一个简单的

=Count(Fields!AgeInYears.Value)

在文本框中获取每个年龄的正确计数。