我的数据如下
Year Period Country STATUS COST1 COST2 TOTAL COST
2019 1 Australia PERM 100 200 300
2019 2 NZ PERM 200 200 400
2019 3 ASIA TEMP 400 200 600
2019 4 NZ TEMP 500 200 700
我想在SSRS报告中显示 我需要如下所示的ROWS中的COLUMN和STATUS的期间,以及数据部分中的总费用
Period
1 2 3 4
+ PERM总费用
+温度 当最终用户打开+时,它将显示更多详细信息。但是否则就这样。
Year Country COST1 COST2 TOTAL COST
PERM 2019 1 Australia 100 200 300
2019 2 NZ 200 200 400
TEMP 2019 3 ASIA 400 200 600
2019 4 NZ 500 200 700
预先感谢
答案 0 :(得分:0)
您似乎想要条件聚合:
select status,
sum(case when period = 1 then total_cost else 0 end) as total_cost_1,
sum(case when period = 2 then total_cost else 0 end) as total_cost_2,
sum(case when period = 3 then total_cost else 0 end) as total_cost_3,
sum(case when period = 4 then total_cost else 0 end) as total_cost_4
from t
group by status;
答案 1 :(得分:0)