I've got a monthly report that is generated from data recorded each day. At the bottom of the report I have Sum, Min, Max, and Avg for certain fields.
I need to be able to also get data from the last day of the previous month to display at the top of the report, but this data cannot be included in the Sum, Min, Max, and Avg.
I'm assuming that this means I must run 2 separate queries and am unsure of how to do to this properly. I'm also curious if it might just be easier to run VBA on report Open to subtract from the earliest day in the query results and display the data that way.
What is going to be the easiest method to achieve these results?
VBA would work, but I think this is a better case for a subreport.
In the design view of the report, you should have a subreport tool. Drag and drop that, then set your source to the other query results you wish to display.
Related
2008 SSRS
Hi, I am trying to make a timeline chart using two different datasets in my report. My first PERMIT NO works and counts perfectly. However, when I use my second PERMIT NO from the second dataset, it will sum them for each day. It should be showing 2 on 7/16, 1 on 7/17, and 0 for the rest of the month. But as you can see, for some reason it puts 3 for each day and I'm not sure why. Here is my expression being used:
Count(Fields!PERMIT_NO.Value, "DataSet2")
How would I go about fixing this? I tried sum, countdistinct, etc. but nothing worked properly.
Chart
Chart Properties
Unfortunately, your count is getting the count of all PERMIT_NOs in DataSet2. The COUNT doesn't filter by your date.
You'll need to use a LOOKUPSET to get the data and then a VBA function like SUMLookup to SUM them.
Here's an answer that's similar to yours. Since you want a COUNT, use the number 1 to SUM instead of your PERMIT_NO field.
Need help in calculation using two Datasets using Expression SSRS
I have a Report, I hope that if you choose to end time more than 7 days of the start time is prompt error.
Rather than give your users two date parameters have a single parameter to select the reporting period. You can use a SQL query to generate a list of weeks and then allow them to select which week they want to see data for. That way they can't ever select more than 7 days.
Otherwise you can short circuit the SQL by adding a DATEDIFF() between the two parameters. You could use an IF statement for this but you'll need to ensure that it returns the same columns and data types or I think SSRS will error out.
Otherwise just add the DATEDIFF() check in the WHERE clause so it will return no rows if the parameters are too far apart.
You'll also want to create a textbox on the report and have it conditionally visible if the parameters are too far apart. Something like big red text explaining to the user that they have selected a date range that is too large.
But, I think showing error messages should be avoided when you can just adjust the choices offered to the user so that they can't choose something that is invalid.
In the report I am building I have 2 data sets: one gives me, per user, per day, the total amount in that status; the other one gives me, per user, how many days in the date range the user actually showed up at work. Each of these data sets comes from its respective stored procedure. See screenshot.
The problem I have is that I need to report not the total time in status per user, but the average per day. So in the screenshot you can see that one user has 5 entries for 5 days worked and the other one has 3 entries for 4 days worked. simply because in one of those 4 days he didn't had that status at all.
I tried adding a calculated field to my "status" data set by using the lookup() function but it kept on giving me errors, which makes me think I don't quite know how to use it.
I also tried using group variables, and I was able to define it under group properties, but it never come up as an option to be used when writing an expression.
Any ideas using lookup(), variables or otherwise?
You're on the right track. Sounds like the Lookup function is exactly what you want.
Instead of trying to add the calculated field to the dataset, try putting it directly in the report item where you want this displayed.
Something along these lines should work:
=SUM(Fields!Available.Value)
/ Lookup(Fields!UserId.Value, Fields!UserId.Value, Fields!Days.Value , "NameOfDaysDataset")
If this isn't working, please post a few more details of your data sets, field names, and where you need this to appear.
I swear this shouldn't be that hard, but it's been a real struggle.
I have a query that returns a site name, an event date, and the count of events. I use it in a very nice chart to show events by day.
I now want a Tablix to show the sum of those count of events by site. That is, ignore the date and just sum the counts.
I know I can write another query to accomplish this, but I'd rather minimize the number of queries in this report. How can I use the existing query to create the Tablix that I want?
in the tablix, create your group/groups that you want to sum by, then add the sum of the field you're summing. If you exlude the date in the groups then it'll just sum by whatever you group by.
I have a database to calculate my expenses. I record expenses with negative numbers, and salary with positive numbers. When I make the month report, and sum the values, it sums it all including salary. I want to code of Visual Basic to sum negative numbers only. I know about Filter property, but the Filter I put disappears when I close database. Can you help me, please?
You can build your report using a query or use the Where argument of the OpenReport method of the DoCmd object in versions of Access since 2003.
EDIT re comment
The easiest way to create a query is to use the query designer, viewed in SQL View, you should see something on the lines of:
SELECT Amount
FROM MyTable
WHERE Amount <=0