gpt4 book ai didi

reportingservices-2005 - 按指定顺序对矩阵报告列进行排序

转载 作者:行者123 更新时间:2023-12-04 00:47:58 25 4
gpt4 key购买 nike

我编写了以下 TSQL 以在报告中使用:

SELECT     patcnty, CASE WHEN CAST(age_yrs AS int) <= '5' THEN 'Ages 5 and Younger' WHEN CAST(age_yrs AS int) BETWEEN '6' AND 
'17' THEN 'Ages 6 to 17' WHEN CAST(age_yrs AS int) BETWEEN '18' AND '44' THEN 'Ages 18 to 44' WHEN CAST(age_yrs AS int) BETWEEN '45' AND
'64' THEN 'Ages 45 to 64' WHEN CAST(age_yrs AS int) >= '65' THEN 'Ages 65 and Older' END AS AgeGroup,
CASE WHEN patcnty = '54' THEN 'Tulare' WHEN patcnty = '16' THEN 'Kings' WHEN patcnty = '15' THEN 'Kern' WHEN patcnty = '10' THEN 'Fresno' END
AS County, oshpd_id, age_yrs
FROM OSHPD2009
WHERE (patcnty IN ('10', '15', '16', '54')) AND (age_yrs <> ' ')

我创建了一个 SSRS 2005 矩阵报告,并将 AgeGroup 作为我的列,将 County 作为我的行。显示报告时,列的顺序为:18 至 44 岁、45 至 64 岁、5 岁及以下、6 至 17 岁和 65 岁及以上。这是有道理的,因为我将组的排序顺序设置为升序。

如何更改矩阵列的组排序顺序以按此方式排序:5 岁及以下、6 至 17 岁、18 至 44 岁、45 至 64 岁和 65 岁及以上?

非常感谢您的帮助!

最佳答案

经过一些挖掘,我决定需要告诉 SSRS 以什么顺序对组进行排序。因此,在列分组排序屏幕中,我添加了一个表达式

=iif(Fields!AgeGroup.Value="Ages 5 and Younger","1",
iif(Fields!AgeGroup.Value="Ages 6 to 17","2",
iif(Fields!AgeGroup.Value="Ages 18 to 44","3",
iif(Fields!AgeGroup.Value="Ages 45 to 64","4",
iif(Fields!AgeGroup.Value="Ages 65 and Older","5","Other")))))

这基本上强制 SSRS 按照我指定的顺序对组进行排序,方法是为 5 岁和更小的年龄分配 1 的值,因此它是第一个排序组等。我的报告现在就像一个魅力!

关于reportingservices-2005 - 按指定顺序对矩阵报告列进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4673268/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com