The easiest way to achieve this is, first of all, to write your query, which pushes the results in this way.
SQL Server Query
SELECT DATEPART(MONTH, Date_Column) AS [Monthly] ,DATEPART(WEEK, Date_Column) AS [Weekly] ,SUM(Some_Column) AS Total FROM Table_Name GROUP BY DATEPART(MONTH, Date_Column) ,DATEPART(WEEK, Date_Column)
SSRS Report
Add a matrix data area. Drag the Total column to DATA .
Create a say GROUP ON of Text parameter and enter the values
1) Weekly 2) Monthly
Now below in the ROW GROUPS right-click only the visible row group and go to GROUP PROPERTIES In the GROUP ON section, enter the following expression.
=IIF(Parameters!Groupby.Value = "Monthly", Fields!Monthly.Value, Fields!Weekly.Value)
Use the same expression in the ROWS data ROWS .
For the column name, you can use the following expression ...
=IIF(Parameters!Groupby.Value = "Monthly", "Monthly", "Weekly")
and you are good to go.
Important Note
SSRS is a cool tool for presenting data, which is not so cool when it comes to data manipulation, to improve performance, all types of data manipulation are closer to the source (database, SQL Server).
All presentation materials must be processed in SSRS.
M.Ali
source share