How to display in between records in crystal - crystal-reports-xi

i have a table which contains events from an access control system.
I want to show First In and Last out of the employee per day(working hour 8:00 to 5:00),in addition to this
i want last out and Last in for the lunch break(in between 12:45 & 2:15) for that day.Other events should be suppressed in the report.
I'm facing a problem to design the report.Pls help me...

Assuming you have a grouping of employee with all of that employee's swipes below that, you could do a Min and Max of the time field at the employee level. Do a grouping of day above employee to make it just the records for that day.
For the lunch break, you could do a grouping on a formula which filters swipe times which are greater than 12:45 but less than 12:15, then just min and max on these within that grouping.

Related

Combining a dynamic total by state in Tableau

I am using a US shootings database where the event is specified by 3 columns, state event occured, date, total casualties. I want to make a dashboard in Tableau that has dynamic sum and sorting where if the year column was a page that I could click through, the graphic would reflect the top ten states of sum(casualties) of that specified range. So my data ranges from 1924-2022, and if I started the page at 1980, it would graph the top 10 states with the sum of totals between 1924-1980. The next page could potentially be a different top 10 of states and would reflect the current top 10 states as the sum(casualties) from 1924-1981.
I hope this makes sense. I apologize if it does not as I am just starting out. I did attempt to sort the data in python by making a column for each year, and you could move horizontally along a state to see it's totals change as each year goes by. Would it be best to add these year columns as a group and sort by top 10 and year that way?
Edit:
Attempting to click through the year filter and dynamically sort the graph by top 10 states with total shootings from 1924-current year
Can you use SQL to query the database? If so, you can insert a date parameter in the query that replaces the use of pages to calculate the sum based on the earliest datapoint to the year you have selected and then just click show parameter. When you create the parameter make sure you set step size to one year and switch the parameter to slider. You can also create a state parameter that is based off that column of data and then use it to filter the data in SQL. However, you may need to use a calculated field or SQL case statements if you want to change the granularity from all the states to one selected state.
I hope this helps you. If you need more clarification, please comment and I will try to provide an example.

I need to be able to count by hour the first iteration of each unique story

I get data from our CMS that shows all actions of staff within that system.
My challenge is to be able to show in a chart only the first iteration of each story as published and the hour in which it occurred.
A single story can be published multiple times during a day.
Using countuniquesif I can get the number of unique stories per hour by using:
=COUNTUNIQUEIFS(Sheet0!I2:I60000,Sheet0!G2:G60000,"NL_Stories/Ready",Sheet0!E2:E60000,"Webpub",Sheet0!B2:B60000,"08")
=COUNTUNIQUEIFS(Sheet0!I2:I60000,Sheet0!G2:G60000,"NL_Stories/Ready",Sheet0!E2:E60000,"Webpub",Sheet0!B2:B60000,"09")
Etc
However, if that story is published in the period from 8am-9am (08 in column B), if it is published again between 9am-10am (09 in column B) it will be counted again.
How can I limit this to just the first time it is published and excluded in any of the other hours.
I have attached a spreadsheet with two tabs, one with the raw data and two with what I currently do.
Any assistance appreciated
https://docs.google.com/spreadsheets/d/1V-kZyUUfXtaf6pMYDCxNSUjjWclOrUcW2Pk2y678RZo/edit?usp=sharing

Algorithm for tracking changes in value over time

I am writing a rails app that deals with product inventory. I would like to include the following features, and am struggling with developing an efficient algorithm:
View stock history (how many were in stock on each date)
Quantity removed from warehouse, and quantity added to warehouse over specific periods of time
Amount of time the product was out of stock in any given period
My questions are as follows:
What is the best way of tracking changes? In addition to my Products
table, should I create another table called
HistoricProductQuantities, and insert a new record each time there
is a change in the quantity?
What number should I track? The historic stock quantity (i.e. 50 in
stock on this day, 24 in stock on that day), or the CHANGE in stock
quantity i.e. -5 (5 sold) or 15 (15 added to inventory)? Or do I
track both in separate tables?
Thanks for your help.
First of all I recommend implementing Date Dimensions on your application, as it seems like you will be doing a lot of Time related calculations. Search on Google for date dimensions as it's beyond the scope of your questions. That said, I believe it will be of great benefit for your app to implement and use date dimensions.
As far as your direct questions go:
What is the best way of tracking changes? In addition to my Products table, should I create another table called HistoricProductQuantities, and insert a new record each time there is a change in the quantity?
Yes you could do this, I would probably call it HistoricProductSnapshot and keep track of the product activity in there on daily basis. With this information as well as time dimensions you could do calculations such as "how many of Product X Did we have 5 days ago or a month ago etc etc."
What number should I track? The historic stock quantity (i.e. 50 in stock on this day, 24 in stock on that day), or the CHANGE in stock quantity i.e. -5 (5 sold) or 15 (15 added to inventory)? Or do I track both in separate tables?
I do not have experience writing inventory control software but I believe with the Snapshot table I mentioned on the question above you would only have to keep track of quantities per day. The Change in product counts could then be calculated from your snapshot table. You could for example have a function that will output the product amount in a given time range as an array. Example: From March 1 to March 7 these were the stock amounts for Product Y [45,40,39,27,22,45,44].
Hope that helps. As I said I am not a product inventory guy but I have worked with Point of Sales Systems and the procedure above should give you a could enough start for what you are trying to do.
This gem could be usefull for tracking changes in models https://github.com/collectiveidea/audited
Keep the data raw. I would personally create a new data entry every day, displaying how much items you have in stock per day. Or you can make the interval much shorter, such as every 12 hours.
For our particular use case:
We had a table called Days, which had a many to many relationship with products, and each "relationship" will have a value called quantity (to keep track of quantity of product per day). Additionally per relationship, we had another value for the relationship with transactions (a one to many relationship) that has the entries for the time of transaction and remaining stocks.
I would personally advise you to use the quantity of stock as the raw data, as it will enable you to gather the data such as how much items were removed during a certain transaction, when the item was out of stock and when it became in stock, all through the data. When you have data in which you need to perform statistical calculations on, it's best to store this data as raw values (quantity of the item).

Google Sheets sorting by time

So I am in charge of office hours for a class at my University. I have to send out a google form every week for the students to sign up. The way the form is sent back, the data is grouped by Name, and the times they are available are grouped by days.
To make it easier on myself, I want to group it by times. Basically, I want it so that each day/time will have its own row, and the names of the people who want the time slot would be grouped together in the adjacent column.
I already separated the groups of times so that each time has its own cell, but I cannot figure out how to regroup the data by time.
I should also mention that each session of OH is 30 minutes and that each student can only receive one session of office hours a week because of limited availability. I also need to group the sessions into blocks so that the teachers won't have idle time (basically a teacher will have office hours from 5:00-6:30 PM on Tuesday, instead of 5:00-5:30 PM and 6:00-6:30 PM on Tuesday and 8:00-8:30 PM on Thursday). Grouping the names of the people who want office hours by the times that they are available would make it a lot easier to set up that week's office hours schedule.
Here's a link to an example:
https://docs.google.com/spreadsheets/d/1fRYYNUoEcgynU9cDMoXzsyjtIir4hsRlfFYJau36a78/edit?usp=sharing
have a look at this sheet ( i have only turned on sharing temporarily, co copy this to your own drive)
Look at the "matrix choices" sheet.
I created a Matrix of students and times (which I think is better), but there is also a list of names for each timeslot on the end too.
have a play changing some of the 1's (sessions applied for) to "G" (short for Granted). Ive set up some conditional formatting and data validation.

How to divide group of field with another group of fields in Crystal Reports graphs?

I am creating a Crystal Report which consist of a graph. As I am new to this, I might be having problem with a very simple issue.
I have a table which consist of date, actual_rev, hrs_available, etc.
Now what I need in the graph is for each date sum of the actual_rev/ sum of the hrs_available. And this should be done grouping of every single date so that graph shows bar of each date.
In the above example the revenue sums up to 2317.00 and the hours sums up to 15.33 , getting the revenue per hour 151.14, which should be shown in the graph for this date.

Resources