How can I calculate YTD values in report? - reporting-services

My client has a standard report which shows monthly figures for various sales, enquiries etc. The report shows all months since the start of the contract (about three years ago, but growing by 1 every month!). The last row in the Tablix shows the totals (essentially the sum of all cells in that column above).
They have asked me to introduce another couple of rows, showing Year To Date values, for totals and monthly averages. I feel sure that there must be a way to do this simply (essentially it is the SUM or AVG of the last 12 rows in the Tablix), probably through grouping, but I just can't get my head around it.

Related

RunningCount/RunningSum Business Objects - how to reset every occurrence of blank

I have a table in Business Objects in which I have created a monthly date spine and I can see how many items a customer bought in a monthly period. What I am trying to do is count the number of months in which no purchases were made and then find the longest gap across the whole date range.
Here is a mock-up in Excel of what I have got so far in Business Objects:
As you can see I have a running count, but it continues counting every time a blank row is encountered. What I want is that the counting would reset every time a new blank entry is found. I could then find the maximum gap across the date range.
What it should look like is:
The formula I have at present is:
=RunningSum(IsNull([monthly_purchase]);([monthly_purchase];[date]))
How can I adapt this to get the result I want?
Is there a reason you need the running count of months? Or is the main objective to determine the maximum number of months in a row with no purchases?
Prior Month with Purchases = Previous([MonthEnd])
Months Between with No Purchase =If Not(IsNull([Prior Month with Purchases])) Then MonthsBetween([Prior Month with Purchases];[MonthEnd]) -1 Else 0
Maximum Gap With No Purchase =Max([Months Between With No Purchase])

Power Bi Report Builder - Calculating change from last year

So I have 2 datasets. One is stats for year 2022, one is stats for 2021. I want to compare the numbers (totals) for each year in each category. I did this by creating a tablix using the wizard for each dataset. The last column is a measure imported from the data set and it calculates the percentage change from the same total in the previous year. As you see everything matches except the totals highlighted in red. For example, Full-Time Domestic is 18 in 2022 which is down 66.67% from 2021's number which is 54. This is correct, however the total: 284 in 2022 is not down 74.31% from 2021; It is summing the changes. I tried removing the sum() function but it just returns the first number (-66.67%) instead of the actual change. I'm still fairly new to power bi and report builder so I'm not sure how to fix it. I've blurred some info for privacy reasons.
Screen Shot of Tablix

After forcing SSRS to show limit number of records in each page, aggregation is getting calculated on each page, instead of whole group

Hello and Please help me! I-m really stuck.
I have a matrix in which exist two groups of Year and Month. So it shows an aggregation of values of matrix based on Year and Month.
This report was slow. That's why I forced this matrix to show 500 records in each page and I have done this by adding a Parent Group and writing an expression for that group.
The problem is that now the aggregation is done at the end of EACH page instead of the end of group.
for example let's say I run the report for the Year of 2019 and the month of November and there are 3000 records of data which are shown in 6 pages. Instead of having the Sum for my values for the whole month of November, the report is calculating and showing the Sum at the end of each page. But I want to have the Sum just when the month changes, so at the end of the month.
Instead of making your group a parent, add your page break group between your last group and your detail.
Make the page break column as small as possible (I have left it wide in my example)
Your layout will look like the images below (for demonstration I have created pages of max 10 rows)

SSRS compare week to the same week number from previous year

I am working on an SSRS report that gets its data from an OLAP cube. In the OLAP cube I have a field named WeekOfYear which gives me the week number of the year based on the date. For example, week 1 for January 1st (if January 1st falls on a Monday) and week 2 for January 8th. My data is grouped by this field but now I want to be able to compare the data from this week of the year to the previous year's week of the year. Like comparing Week 1 of 2015 to Week 1 of 2014. Is there anyway that I can accomplish this? I appreciate any help. Thanks.
There is a LookUp function that should be able to do what you need.
You mention you have a WeekOfYear field. This also assumes you have a Year field (or can calculate it with **YEAR(Fields!YouDateField.Value) )
=LookUp(Fields!YourYearField.Value - 1 & "|" & Fields!WeekOfYear.Value, Fields!YourYearField.Value & "|" & Fields!WeekOfYear.Value, Fields!YourValueField.Value, "YourDataSet")
If you are actually summing multiple rows of data from your cube, you would need to use LookUpSet to get all the values and sum them with a custom function (since Microsoft couldn't possibly envision users wanting to SUM multiple records). Luckily users have already created a function - SumLookup. See How to combine aggregates within a group with aggregates across groups within SSRS if needed.
If you have access to the OLAP cube and can edit this, you could define a new Calculated Measure on the cube. How exactly this would work depends on the set up of your date hierarchies. You can also access this and define calculated measures through the Query Designer while constructing your dataset in Report Builder/Visual Studio.
Right-click in the cube browser and choose "New Calculated Member".
Reporting on weeks across years can be difficult due to the fact that the number 7 doesn't fit neatly into 365 or 366, so you always end up with a little over 52 weeks. Since the 1st of January could be a Sunday one year, and a Tuesday on the next (2012/2013), it's not always a good idea to directly compare these. So people may work around this by defining the 7-day weeks for the year against their date dimension. One year you may have 52 weeks, another you'd have 53. This is a little off topic, so I'll link to an explanation of this here, but it is important to be aware of this in order to implement my suggestion below.
Assuming you have a nice hierarchy on your date dimension that can aggregate up Weeks to Year level, you can create a new measure in your cube using the ParallelPeriod function.
[Measures].[SalesSPLY] AS
(
ParallelPeriod
(
[Dim Date].[ReportingCalendar].[ReportingYear],
1,
[Dim Date].[ReportingCalendar].CurrentMember
),
[Measures].[Sales]
)
My example MDX assumes that you already have a hierarchy called ReportingCalendar created on your date dimension. Yours may be named differently.
Now if you browse your cube and select WeekOfYear, Sales, and SalesSPLY, you will see your value for this year's week 1, alongside last year's.
OLAP cubes are very good at this type of time-based intelligence, as they can very quickly provide aggregated and offset data in a way that would be slower to run in an RDBMS or within SSRS itself.

Limit the times users can work with my web app

I have a simple web app and I would like to limit the times the user can use my app.
Basicly my app generate some report, so I should count how many report they generated in a month.
I was thinking to create a database table where I store the month and the times count of generated report. Each time user generate a report the script check the month to see if is current month and if is current month it increase the times count. Instead if the current month is different it sets the times count to 0.
Is this a good start point? or i should make something better?
If it is current month and if is current month it increase the times count. Instead if the current month is different it sets the times count to 0.
You will miss out on the edge case when a user generates reports after a period of approx 1 year. Say he generates 5 times report in October 2012 , and next tries to generate a report in October 2013, then his counter starts from 5 instead of 0 in the current scenario.
I am assuming you are taking two fields to store the information currently (one field for month, the other for count).
So now, Including the year, you will need 3 fields.
To optimise on number of fields, you can instead save the date for the 1st day of current month (2 fields total).
To further reduce the number of fields, you can save the information in one field - save an integer, say yymmxx, where yy is the year, mm is the month, and xx is the number of attempts.
In this approach, to find out previous number of attempts, you will need to do field % 100, and to match if the current month is same, you will need to check for field/100 == yy*100 + mm