简体   繁体   English

在 SSRS 1 中显示 2 个 tablix 用于参数,另一个用于参数的先前值

[英]Display 2 tablix in SSRS 1 for paramter and the other for previous value of parameter

Im working on report for a periodic form.. Its form that be collected every Quarter of year Q1 2021 Q2 2021 Q3 2021我正在编写定期表格的报告。它的表格每季度收集一次 2021 年第一季度 2021 年第二季度 2021 年第三季度

I want to make a report for multiple indicators that is displayed on tablix based on Quarter user choose using single choice parameter我想根据 Quarter 用户使用单选参数选择在 tablix 上显示的多个指标制作报告

Quarter: Q2 2021季度:2021 年第二季度

Q2 2021 Tablix 1 data 2021 年第二季度 Tablix 1 数据

But the challenge for me is to display automatically a previous Quarter to compare When I choose a specific parameter value但对我来说挑战是自动显示上一个季度来比较当我选择一个特定的参数值时

Quarter: Q2 2021季度:2021 年第二季度

Q2 2021 Tablix 1 data 2021 年第二季度 Tablix 1 数据

Q1 2021 Tablix 2 data 2021 年第一季度 Tablix 2 数据

Any ideas How to do it Thank you任何想法 怎么做 谢谢

Whether you do it in the SQL or in an SSRS filter, the Quarter parameter year and quarter would need to be parsed out, the quarter subtracted, and then converted back to the correct format.无论您是在 SQL 还是在 SSRS 过滤器中执行此操作,都需要解析出 Quarter 参数年份和季度,减去季度,然后转换回正确的格式。 I am assuming that you already have a field to use the parameter.我假设您已经有一个字段可以使用该参数。

WHERE Q IN (@QUARTER, 
            'Q' + 
            CAST(CAST(ISNULL(NULLIF(SUBSTRING(@QUARTER, 2, 1), '1'), '5') AS INT) - 1 AS CHAR(1)) + ' ' + 
            CAST(CAST(RIGHT(@QUARTER, 4) AS INT) - IIF(SUBSTRING(@QUARTER, 2, 1) = '1', 1, 0) AS CHAR(4))
            )

This will create the previous Q by taking the quarter of the parameter, converting to NULL if it's one, then if null, convert the q to a 5 and subtract 1 to get the correct quarter.这将通过获取参数的四分之一来创建前一个 Q,如果它是一个,则转换为 NULL,然后如果是 null,则将 q 转换为 5 并减去 1 以获得正确的四分之一。 It adds a space and then the year, subtracting a year if the q was 1.它添加一个空格,然后是年份,如果 q 为 1,则减去年份。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM