simple average calculation in Access XP report - sql

i have a database used at work for evaluating calls, the database is somewhat dated and originally created on Access XP. Once evaluated these calls are given a score out of 5 which is entered along with other data (such as date, employee name, etc) on a form. I have the reports set up so they generate when you enter the employee name and then the start of a date period and the end of a date period, the report will then generate and show the entries made between those 2 dates. i am trying to include a section on the report which shows an average of the call score for the employee for the period chosen. I understand this may be pretty simple but i'm struggling! cheers, Kris

If you want to work out group calculations on reports, you can either put them in the group header/footer, or report header/footer (for calculations over the whole report).
In this case, placing a textbox with something like =AVG([CallScore]) as the control source in the Report Footer should work.
This page should explain more about using aggregate functions in reports: http://office.microsoft.com/en-gb/access-help/summing-in-reports-HA001122444.aspx

Related

MS Access - Report to only show items that are out of date/or soon to be

Context:
Due to the remote nature of working, the team I work in each have a laptop that they're using for their role (we have thinkpad displaylink units when in the office to connect the laptop to screens). I am working to improve the current allocation records file, which was just a big spreadsheet that you just added a new user to the bottom row. It was messy and hard to read at times, so i've decided to move the data into MS Access and created my data entry and user lookup form, which are working perfectly and make the job easier. I have also been able to make a number of reports that will come in handy too (who has what model ect).
Query:
Now the issue is, each of the laptops have a warranty and I am able to produce reports which lists the users and their warranty due date, but this will show all the warranty dates, whether they've been passed or in the future. I want to be able to produce 2 report/queries, the first that will just bring up the laptops who have a warranty that have expired, then another one to bring up those who will expire within the next 6 months so that we can make relevant decisions.
If anyone can assist with this, it will be welcome.
Apply filter criteria to report when opening. Either have parameters in report RecordSource or use code (VBA or macro) to build criteria for OpenReport method WHERE CONDITION argument. Expressions for criteria (ExpireDate is field, substitute with your field name):
[ExpireDate] <= Date();
[ExpireDate] BETWEEN Date() AND DateAdd("m", 6, Date())

SSRS Bar Chart Filtering Incorrectly

I am trying to create a chart showing the 10 highest-performing teams according to their "proportion of target achieved" score.
My dataset comprises every day worked by every individual in my organisation. The data is grouped in a stored procedure by month, team, job role, area of the organisation...
My SSRS report takes this data and sums it at a report level, based on a half-dozen parameters (mainly to the above groups).
The data is presented via a table, showing (for a given person/group/category) the hours worked, actual contact time (time with clients), expected contact time (time they're meant to spend with clients), and the proportion of their target they are achieving (actual contact time / expected contact time). All of this is reported for each of the last 6 months.
I.e.
I wanted to create a bar chart showing the 10 teams with the highest proportion of target achieved values. This variable is calculated in SSRS in order to allow for the data to be more flexible.
SSRS wouldn't let me use that calculation in a chart filter, so I added a denserank (called TeamOrder) for the teams in the stored procedure.
This is where the issue arises.
TeamOrder is used in the filter, and set to <= 10. 10 teams are displayed in the graph, but not the 10 that have values of TeamOrder equal to 1-10. The top couple are right, but in 10th position, for example, it's displaying the 32nd-best team.
Weirdly, when I set the filter to TeamOrder = [value], then it displays the one (correct) team (including the correct number 10 when TeamOrder = 10).
I'm at a complete loss as to what might be happening; any help would be enormously appreciated.

SSRS 2008 not passing multiple values to report run from button click

I have a simple query that I am running within a report on SSRS 2008, this query simply takes a date from the user of the report and a user code which is a simple md5 hashed code based on their local user id.
and this filters down the report to a subset of data relative to the period and the user selected. This report takes the below parameters:
select * from
ops
where [Late Flag] = 'Late Start'
and [Planned Session Start Time] >= #start
and [Planned Session Start Time] < #end
and [Hashed Surgeon 1 Code] IN (#UserCode)
The problem starts to appear when this data-set is filtered down using these parameters and then the user wishes to see the charts, which again is a simple button click, the action of which runs another report showing the charts for the same period.
I am passing the session ID's of all of the sessions relating to the user as a parameter to the charts report. The charts report is only based on the below:
select * from
ops
where [Session ID] in (#SessionID)
I expect to see multiple sessions here if a user has more than one in the period. but the report is only displaying one of these even though I have allow multiple values checked and I am using an IN as can be seen above.
Question is, has anyone had this problem before if so what can I do about it, I need to see all sessions in the same period selected for that particular user. It is very frustrating I have thought of everything I can am I missing something?
After reviewing the suggested approaches kindly provided by #Lukasz Szozda I realised that the best approach for me in this situation would be to create a max and min of each session date that could be passed to the charts report.
This removed the need to parameterise the IN statement. Obviously not a solution for everyone where passing multi values to multi values is required but worked nicely for me.
I must also state that this will only work for passing a single userCode in my setup, if I wanted to see more than one UserCode activity for the same period then I would need to follow the suggested approach and commit to parameterising the IN statement.

Trying to SUM a formula field based on constraints from another field

A little background on the report:
This is a productivity report for our employees working at our business. We determine their productivity based on the duration of the visits with clients. Some of our employees offer group sessions. They charge each client within the group, even though they are only giving, for example, one hour of service, they can bill for 10 hours if there are 10 people in the group. We determine what service they gave by service codes.
So, I have two fields in this formula, a service code field and a duration field.
The duration field is initially a STRING field from the database, even though it only gives number data, so I change it to a numberVar. The service code field is also a string field, and it sometimes does contain characters and numbers.
What I need Crystal Reports to do is take the sum of the duration. However, if the service code is, say, "1000", it must first divide the duration by 3 before summing it. This is where I get caught up.
Here's my code for the duration:
local numbervar num1;
If GroupName ({billing_tx_charge_detail.v_SERVICE_CODE})="1530" then
num1 := ToNumber({billing_tx_charge_detail.v_duration})/3
else num1 := ToNumber({billing_tx_charge_detail.v_duration})
Then I do a separate formula for the sum, named sumDuration:
Sum(#duration)
I get the error that this field cannot be summarized. After searching Google for two days I have found that Crystal cannot summarize fields or formulas involving constants. If I simply say:
local numbervar num1;
num1 := ToNumber({billing_tx_charge_detail.v_duration})
then I can summarize #duration. What am I missing? It has to be something simple, but I'm just not seeing it. Is there a way to create a custom function to accomplish what I am trying to get here? Or is it even simpler than that?
One person suggested creating a SQL command in order to do the calculations before the data gets to the report. I am a SQL newb so I had no idea where to even begin with that.
If you are grouping by Service Code and placing the above formula in the footer you will only be computing {billing_tx_charge_detail.v_duration} for the last record in the group. If you are intending to use the formula and sum the results and place the results in the Service Code footer try the following. (basically remove the reference to group name)
If {billing_tx_charge_detail.v_SERVICE_CODE}) = "1530" then
ToNumber({billing_tx_charge_detail.v_duration})/3 else
ToNumber({billing_tx_charge_detail.v_duration})
You can use variables (num1) if you want to but they are not needed.
You can still use the second formula you referred to and place in the group footer OR you can place the first formula in details section, right click and insert a summary to the group footer. You can also place in the report footer if you need it to total there as well.

Qlikview line chart with multiple expressions over time period dimension

I am new to Qlikview and after several failed attempts I have to ask for some guidance regarding charts in Qlikview. I want to create Line chart which will have:
One dimension – time period of one month broke down by days in it
One expression – Number of created tasks per day
Second expression – Number of closed tasks per day
Third expression – Number of open tasks per day
This is very basic example and I couldn’t find solution for this, and to be honest I think I don’t understand how I should setup my time period dimension and expression. Each time when I try to introduce more then one expression things go south. Maybe its because I have multiple dates or my dimension is wrong.
Here is my simple data:
http://pastebin.com/Lv0CFQPm
I have been reading about helper tables like Master Callendar or “Date Island” but I couldn’t grasp it. I have tried to follow guide from here: https://community.qlik.com/docs/DOC-8642 but that only worked for one date (for me at least).
How should I setup dimension and expression on my chart, so I can count the ID field if Created Date matches one from dimension and Status is appropriate?
I have personal edition so I am unable to open qwv files from other authors.
Thank you in advance, kind regards!
My solution to this would be to change from a single line per Call with associated dates to a concatenated list of Call Events with a single date each. i.e. each Call will have a creation event and a resolution event. This is how I achieve that. (I turned your data into a spreadsheet but the concept is the same for any data source.)
Calls:
LOAD Type,
Id,
Priority,
'New' as Status,
date(floor(Created)) as [Date],
time(Created) as [Time]
FROM
[Calls.xlsx]
(ooxml, embedded labels, table is Sheet1) where Created>0;
LOAD Type,
Id,
Priority,
Status,
date(floor(Resolved)) as [Date],
time(Resolved) as [Time]
FROM
[Calls.xlsx]
(ooxml, embedded labels, table is Sheet1) where Resolved>0;
Key concepts here are allowing QlikView's auto-conatenate to do it's job by making the field-names of both load statements exactly the same, including capitalisation. The second is splitting the timestamp into a Date and a time. This allows you to have a dimension of Date only and group the events for the day. (In big data sets the resource saving is also significant.) The third is creating the dummy 'New' status for each event on the day of it's creation date.
With just this data and these expressions
Created = count(if(Status='New',Id))
Resolved = count(if(Status='Resolved',Id))
and then
Created-Resolved
all with full accumulation ticked for Open (to give you a running total rather than a daily total which might go negative and look odd) you could draw this graph.
For extra completeness you could add this to the code section to fill up your dates and create the Master Calendar you spoke of. There are many other ways of achieving this
MINMAX:
load floor(num(min([Date]))) as MINTRANS,
floor(num(max([Date]))) as MAXTRANS
Resident Calls;
let zDateMin=FieldValue('MINTRANS',1);
let zDateMax=FieldValue('MAXTRANS',1);
//complete calendar
Dates:
LOAD
Date($(zDateMin) + IterNo() - 1, '$(DateFormat)') as [Date]
AUTOGENERATE 1
WHILE $(zDateMin)+IterNo()-1<= $(zDateMax);
Then you could draw this chart. Don't forget to turn Suppress Zero Values on the Presentation tab off.
But my suggestion would be to use a combo rather than line chart so that the calls per day are shown as discrete buckets (Bars) but the running total of Open calls is a line