Im working on report for a periodic form.. Its form that be collected every Quarter of year Q1 2021 Q2 2021 Q3 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: Q2 2021
Q2 2021 Tablix 1 data
But the challenge for me is to display automatically a previous Quarter to compare When I choose a specific parameter value
Quarter: Q2 2021
Q2 2021 Tablix 1 data
Q1 2021 Tablix 2 data
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. 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. It adds a space and then the year, subtracting a year if the q was 1.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.