How do I get last months data in Report Builder? - reporting-services

I am trying to get the YTD data. So the number I want is always the previous months data. In this case the Total YTD should be equal to 6/30/2022 data. 6,163 and 4,678:

Related

Reacts application to Display Json data in Table with colspan depening of repeat of some Rows

i got Json data from my own backend. Sample data is shown below:
[{year:2020,month:1,monthTotal:100,avgTon:3900,rakeType:"BS",typeTotal:50,typePerc:"50.00"},
{year:2020,month:1,monthTotal:100,avgTon:3900,rakeType:"BX",typeTotal:50,typePerc:"50.00"},{year:2021,month:1,monthTotal:105,avgTon:3980,rakeType:"BS",typeTotal:40,typePerc:"38.00"},
{year:2021,month:1,monthTotal:100,avgTon:3900,rakeType:"BX",typeTotal:30,typePerc:"28.57"},
{year:2021,month:1,monthTotal:100,avgTon:3900,rakeType:"BY",typeTotal:30,typePerc:"28.57"},{year:2020,month:2,monthTotal:60,avgTon:3800,rakeType:"BS",typeTotal:50,typePerc:"50.00"},{year:2020,month:2,monthTotal:60,avgTon:3800,rakeType:"BX",typeTotal:50,typePerc:"50.00"},{year:2021,month:2,monthTotal:100,avgTon:3900,rakeType:"BS",typeTotal:100,typePerc:"100.00"},{year:2022,month:2,monthTotal:90,avgTon:3900,rakeType:"BS",typeTotal:90,typePerc:"100.00"}
]
I want to show in table
Month
Year
Month Total
Average Ton
Rake Type
Jan
2020
100
3900
BS-50%, BX-50%
2021
100
3900
BS-40%, BX-30%, BY-30%
Column having Same Value for Month, Year Month Total and Average Ton shoud not repeated for send Row. Where year change. same Month column should be merged.

how do i group customer entries using months across different years in ssrs reports in nav

I am trying to get Sum of each customer ledger entries and group the Ssrs report into months across different years. For instance, I should be able to filter with the year 011117..310318, this should give me entries of each customer grouped per month: November, December, Jan(18), Feb, Match.
You can do this by using a matrix in your report.
Add the matrix and set the row group to group by Customer (whatever makes the customer unique such as an ID).
Add column groups by month and then a parent column group by year. If you don't have separate columns for months and years in your dataset, you can use expression into the group expression such as..
=Month(Fields!myDateField.Value)
=Year(Fields!myDateField.Value)
In the data 'cell' just drag the value you want to aggregate there.
That should give you a basic working matrix.
If you need more help refer to the SSRS documentation on the matrix control.
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/create-a-matrix-report-builder-and-ssrs?view=sql-server-ver15

Count the number of columns in a column group

I need to report the average number of customer visits each engineer makes per month.
My SQL query creates a temporary table of months between the start date and end date and left joins this to the main data table, to ensure rows are returned even for months where no visits were made.
So an example of the data returned from SQL may be:
My report has two column groups, one for year and one for month, and I have a row group for the engineer.
For this report, the date is always returned as the first of the month, even though the actual visit could be on any date.
At the end of each year there is a cell which contains Count(Customer) and totals the number of visits the engineer made in that year. I would also like to have a cell which displays the average number of visits made each month in that year.
For a complete year I could simply divide by 12. However for a partial year I need to count the number of month columns for that year.
I tried CountDistinct(Month) but this only counts months where at least one visit was made, making the monthly average incorrect.
How can I get a count of the number of columns in a column group, including columns with no data?
Thanks.
The way I would do this would be to add a column into your temporary dates table that had the number of months selected in it.
You could do this by either counting the months in the temp table then appending the value to it or, if the dates table contains more than just months then work it out based on the parameters you pass in.
For example
SELECT *, DATEFIFF("m", #startDate, #endDate) as NoOfMonths
INTO #myTempDateTable
FROM myDateTable
WHERE etc...
Then in SSRS you can simply divide your total by this number.

Calculating average in SSRS Matrix Table alongside filtered columns to separate out current versus previous years

I have a dataset, returned from a SQL query, that has the following data:
TYPE_CODE
YEAR
The data set spans the years 2014 through 2019. The TYPE_CODE has 6 different values.
How do I setup an SSRS matrix to provide the following layout and data:
So far I have a matrix setup (see the pic below) that has a row group (TYPE_CODE1) for the TYPE_CODE data, and two column groups (YEAR_PREV and YEAR_CURRENT) that are filtered as follows:
- The second column in the matrix is the YEAR_PREV group, and is filtered to not show 2019 data (YEAR <> 2019)
- The 4th column in the matrix is the YEAR_CURRENT group, and is filtered to only show 2019 data (YEAR = 2019)
This method correctly splits my data, with the green highlighted columns in the pic below representing what is correct:
What is not correct is the average column, as I cannot figure out how to setup that column to only average the columns to the left (the previous years - 2015-2018) and not include the column to the right (2019).
I have tried several different expressions to no avail, primarily trying to limit the count function to only the YEAR_PREV group, like so:
=count(Fields!TYPE_CODE.Value, "PREV_YEAR")/4
This throws an error telling me that something along the lines of "group cannot be used in aggregate function...".
How do I calculate the average column correctly?
You need to have 2 column groups with filters applied, first one where year equals 2015-2018 and the second one equals only 2019.
In between each of these columns you need insert your average column that will reflect years 2015-2018.

SSRS how to show pre-calculated totals

I have a data like
which comes from SSAS. Amount_YTD and Amount_YTE values are as Measures.
YTDs are Year-To-Date values, and YTEs are Year-To-End values regardless of Month filter.
My report design is
So, with this design, YTD and YTE values are SUMed (naturally) and what I get is
So row and column totals and grand totals are not as expected. This is what I would like to achieve,
(some rounding may occur)
How can I get "Expected" report?
For ALI you need to use MAX instead of sum for YTD and MIN instead of sum for YTE looking at your data.
For your other two summary lines toplam and Genel Toplam I would alter your ssas query so that it gives YTD and YTE figures regardless of both customer and month and use these figures in the YTD and YTE columns