我需要对从日期集之一获取的“付款范围”字段上的SSRS报告实施自定义排序
付款范围如下所示:
$0 - $200
$200.01 - $1000
$1,000.01 - $10,000
$10,000.01 - $20,000
$20,000.01 - $30,000
$30,000.01 - $40,000
$40,000.01 - $50,000
$50,000.01 - $60,000
为了实现而我曾经使用过
=IIF(Fields!netPaymentRange.Value= "$0 - $200", "A",
IIF(Fields!netPaymentRange.Value= "$200.01 - $1000", "B",
IIF(Fields!netPaymentRange.Value= "$1,000.01 - $10,000", "C",
IIF(Fields!netPaymentRange.Value= "$20,000.01 - $30,000", "D",
IIF(Fields!netPaymentRange.Value= "$30,000.01 - $40,000", "E",
IIF(Fields!netPaymentRange.Value= "$40,000.01 - $50,000", "F",
IIF(Fields!netPaymentRange.Value= "$50,000.01 - $60,000", "G","")))))))
但是它对我不起作用。请建议
答案 0 :(得分:1)
我将使用从值中选择查询来创建CTE,以为您的付款范围列表创建排序顺序。然后,您可以加入报表数据集的源表/视图。我仍然建议将payment_range
存储为表格。
WITH
payment_range
AS
(
SELECT tbl.* FROM (VALUES
( '$0 - $200', 1)
, ( '$200.01 - $1000', 2)
, ( '$1,000.01 - $10,000', 3)
, ( '$20,000.01 - $30,000', 4)
, ( '$30,000.01 - $40,000', 5)
, ( '$40,000.01 - $50,000', 6)
, ( '$50,000.01 - $60,000', 7)
) tbl ([netPaymentRange], [netPaymentRangeSortOrder])
)
SELECT
*
FROM
payment_range --join to your source table here
ORDER BY
[netPaymentRangeSortOrder]