I have a table with a start and end date for each record, and a duration between the two that I have calculated. I now need to group these durations by intervals (1-29, 30-59, etc) and count how many durations fall in each category, displayed in a form/report. How should I both count the number of durations as well as filter them by size?
Construct a field with calculation that assigns an identifier for the interval groupings.
Switch([Duration]<30,1, [Duration]<60,2, [Duration]<90,3, True,4)
Or try the Partition() function. https://support.office.com/en-us/article/Partition-Function-1A846A33-60C7-4371-8E77-C94278274DC5?ui=en-US&rs=en-US&ad=US&fromAR=1
Use Report Sorting & Grouping features and do the summary aggregate calcs in textboxes on report.
Related
Im trying to average the past 5 rows in my table i created in SSRS grouped by date(Monday of every week). Ive tried runningValue however it looks back at all the past rows for each group. Is there a way to limit the scope to just the past 5 rows or weeks for each Date group.
Thanks
I would accomplish this with grouping. I don't know what your dataset is like but I assume it is a SQL query you can modify. The easiest solution would be to add a week number column to your query. For example:
SELECT datepart(week, YOURDATE) as WeekNumber
More info on datepart:
https://learn.microsoft.com/en-us/sql/t-sql/functions/datepart-transact-sql?view=sql-server-2017
Once you have a week number, use the table creation wizard in Report Builder and add WeekNumber as a row group. This will group your values by week number and give you a total under each week. You can change the total by double clicking and making it AVG() instead of SUM().
Note: If you already have each 5 day period in a group, you should be able to right click that and add total. At which point you can just change the SUM to AVG there.
I have a table of travel expenses for analysis.
I would like to create a calculated column with a value for the maximum count of records with a certain category for each employee on any given day.
For example, if the category being reviewed is "dinner", we would like to know what is the maximum number of dinner transactions charged on any given day.
The following custom expression was able to count how many dinner expenses per employee:
count(If([Expense Type]="Dinner",[Expense Type],null)) over ([Employee])
But when trying to get the max count over days, I cant seem to get it to work. Here is the expression used:
Max(count(If([Expense Type]="Dinner",[Expense Type],null)) over ([Employee])) over (Intersect([Employee],[Transaction Date]))
This seems to provide the same answer as the first expression. Any idea on how to get this code to identify the value on the date with the most expenses for each employee?
If i understand your question and comments correctly, you should be able to use intersect.
count(If([Expense Type]="Dinner",[Expense Type],null)) over (Intersect([Transaction Date],[Employee]))
You may need to cast [Transaction Date] as a date if it is an actual DateTime. Otherwise you'd get one for each unique DT.
When trying to manipulate and display date from ONE table, I am having difficulty coding it correctly.
I need to, from the same table, find the amount of Services done per day (Which has been done, based on the Count of ServiceId). I then need to find the OverallCharge (done) and find the min, max and avg of these overallCharge (s) per day (BasicCharge + AdditionalPartsCharge + AdditionalLabourCharge)
I need to display these charges per ServiceDate in the table
My draft is the following but is telling me that ServiceId is not part of an aggregate function.
SELECT Service.ServiceDate, Service.NumServices , Min(OverallCharge) AS MinOverallCharge, Max(OverallCharge) AS MaxOverallCharge, Avg(OverallCharge) AS AverageOverallCharge
FROM (SELECT Service.ServiceId, Sum([BasicCharges]+[AdditionalLabourCharges]+[AdditionalPartCharges]) AS OverallCharge, Service.ServiceDate, Count (Service.ServiceId) AS NumServices
FROM Service
GROUP BY Service.ServiceDate, NumServices, MinOverallCharge, MaxOverallCharge, AvgerageOverallCharge);
Thanks
everyone. For the life of me I cannot figure out why the X-Axis is pulling 2 dates in each month when I want it to group by each month. In the Values I have:
Value Field =RunningValue(Fields!new_actualsalesfromsplit.Value, Sum, "Chart1_SeriesGroup")
Category Field: =Fields!closedate.Value
Category Groups =Month(Fields!closedate.Value)
Group On =Month(Fields!closedate.Value)
Series Group by ["salesperson']
The chart should have a line for each sales person, and each month should be a cumulative representation of the sales by that person. Thanks for any help.
Set the category field to "=Month(Fields!closedate.Value)", or something similar that will net the results you need. Right now, even though you're grouping by month, you're still telling SSRS to use the atomic data for your X axis, so that's what it's doing.
It may make your task simpler to just add a Calculated Field to your dataset - open the dataset properties window, go to the fields tab, and click "add". Set that field to your month value, use it for grouping and your X axis.
I'm using MS Access 2010
My query has the fields, Date, Market Price, Actual Price
I need to separate out within the query by date Actual Price/Market Price in order to achieve a percentage which I can then average (for that day only, one day at a time)
Each day will have anywhere from 10-50 items.
You'll want to use a standard query, but a totals to the query. On the Home tab, in the Records group, click Totals.
Once you have that field displayed you can put a Sum (in the Totals field) for Market Price and Actual Price; and then make sure the Date field is set to GroupBy.
Then you should be getting totals for the Price fields grouped by Date.
btw., I'd label that date field something else other than just Date (e.g., DateSold, PurchaseDate, etc.) just to avoid confusion and possible conflicts with the Date type.