AgendaWeekView: Manipulate day split at midnight - fullcalendar

First of all thanks to Adam Shaw for his great Fullcalendar. I have a problem with the automatic day splitting, whenever an event belongs to two days. This works great in general, but is a problem in my specific use case:
I modified AgendaWeekView to show multiple rooms side by side, so each day has multiple rows:
2011-01-01 | 2011-01-02
R1 | R2 | R3 | R1 | R2 | R3
I customize my events before giving them to Fullcalendar, mapping 2011-01-01 Room 1 at 2011-01-01, 2011-01-01 Room 2 at 2011-01-02, ... 2011-01-02 Room 1 at 2011-01-04 and so on.
Everything works fine with some changes to AgendaWeekView.render.
My only problem are dates starting e.g. at 2011-01-01 11pm: If they are longer than one hour, FullCalendar shows their end at the next day, which is - in my case - unfortunately 2011-01-01 Room 2. I tried to find the code splitting the event, hoping to add the room number to the ending part's start date or something like this.
I don't really see this in the code. I hope somebody has advice where to start finding a solution.

Related

Sorting specific values into time buckets

I'm dealing with an enourmous problem. I need to distribute some specific values on a specific time bucket structure simply looking at their expiration date (eventually it is possible to compute the expiration period in days or months or years simply subtracting issue date and expiration date).
So basically, what I'm asking for is this. I have these amounts with relative dates:
and this time bucket structure:
Is there a way to distribute automatically the amounts in first picture into the time structure above using r? Basically first element should go in "tra 12 mesi e 2 anni", the second element in "overnight", the third element in "tra 12 mesi e 2 anni", and the last in "tra 3 e 4 mesi".
Thank you all
Davide

ideas for creating a report

Colleagues, I really need your advice on how to create a report with the following format in Cognos Analitics:
I only have the value "amount of money" and the dimensions "date" and "Person", and I need to display in the report the value for a specific date, and the change from the previous date.
for example, 01.02.2018 Person1 had 50 of the money, and 01.03.2018 Person1 had 61, so field № 3 is equal to 11 (61-50).
As you can see, there is no "change" column after the first field, because there is nothing to compare it with.
Do you have any ideas on how to generate such a report?
P.S. user selects the start date and end date of the report independently in the invitation
Maybe try creating multiple metrics
Call the first Day 1 Amount
Call the second Day 2 Amount
Call the third Day 3 Amount
You could even define each metric relative to the other
Day 1 is based on the date selected
Day 2 is for the prior day
Day 3 is 2 days before... etc
Build the crosstab slightly different. Instead of placing the metric in the middle
place them side by side
Then you can run calculations, %difference, growth etc on the fly

QlikView Script Count Conditional Occurrences

I have a data set that shows engineer visits and the type of job attended.
Engineer's Visit Table:
OrderNum, Engineer, Job Type, Date
1 John Install 01/04/15
2 Phil Remove 02/04/15
3 George Install 01/04/15
4 George Replace 02/04/15
5 George Replace 03/04/15
6 John Install 01/04/15
7 John Install 01/04/15
8 John Replace 02/04/15
9 John Remove 02/04/15
For the example table above - I would like to show for each engineer (but using John as an example):
His predominant job type was "Install";
The total number of jobs he attended was 5;
He worked for 3 days;
Meaning he attended 1.67 jobs per day.
I was attempting to add this to the load script using various additional columns but I'm having trouble getting an aggr/count statement to work.
Is this a reasonable approach or am I going about it the wrong way?
Thanks.
You definitely don't want to do it in the script because then you would have to try and guess any combination of selections your users might make before hand and create aggregations for each case. In the front end it is fairly trivial except for the 1st measure. To illustrate the problem I added 2 more orders for Phil an Install and a Replace so that he has 1 of each
Here is the first draft I made:
Now the problem is that '-' for Phil. The mode() function is working as designed there but I bet nobody wants to see that the job they perform most often is nothing.
I tried a few things but this is as close as I got to something useful:
The expression I used is
`if(isnull(mode([Job Type])),concat(DISTINCT [Job Type],','),mode([Job Type]))`
but it also isn't as good as it could be (now the guys with no clear mode just get a list of all the jobs they've done, rather than a list of the joint most often done jobs. But at least now it looks like they are working). I am however stumped as to how to get it to do what I want

Calculate renewal date DAX

I have a datetime column (starting_date) in a PowerPivot model. I would like to calculate a field showing how many months until next renewal date. Each year a renewal is coming up?
Does somebody have an idea on how to do that dynamically in DAX?
Absent any example data, I set up the following table - Table1 (with the assumption that each Customer can only appear once)
Customer starting_date
a 1/1/2014
b 2/25/2014
c 1/1/2015
d 4/1/2014
Then in PowerPivot I set up the following measures:
[StartingDate] - Used to return the customer's start date
StartingDate:=MAX(Table1[starting_date])
[BirthdayThisYear] - To set date for the current year
BirthdayThisYear:=DATE(YEAR(TODAY()),MONTH([StartingDate]),DAY([StartingDate]))
[ThisYearBeforeToday] - Test if [BirthdayThisYear] is before TODAY()
ThisYearBeforeToday:=if([BirthdayThisYear]<today(),"yes","no")
[NextRenewalDate] - Use [ThisYearBeforeToday] to calculate next renewal date
NextRenewalDate:=IF([ThisYearBeforeToday]="yes",DATE(YEAR([BirthdayThisYear])+1,MONTH([BirthdayThisYear]),DAY([BirthdayThisYear])),[BirthdayThisYear])
You could do all the above in one step, but I find it difficult to debug later and hard to read. It could also likely be done more cleanly, but it works (as I understand your requirements)

timedeltas and datetimes subtraction and converting to duration in minutes

I am at a standstill with this problem. I outlined it in another question ( Creating data histograms/visualizations using ipython and filtering out some values ) which meandered a bit so I'd like to fix the question and give it more context since I am sure others must have a workaround for this or have the problem. I've also seen similar, not identical, questions asked and can't quite adapt any of the solutions thus far given.
I have columns in my data frame for Start Time and End Time and created a 'Duration' column for time lapsed. I'm using ipython.
The Start Time/End Time columns have fields that look like:
2014/03/30 15:45
A date and then a time in hh:mm
when I type:
pd.to_datetime('End Time') and
pd.to_datetime('Start Time')
I get fields resulting that look like:
2014-03-30 15:45:00
same date but with hyphens and same time but with :00 seconds appended
I then decided to create a new column for the difference between the End and Start times. The 'Duration' or time lapsed column was created by typing in one command:
df['Duration'] = pd.to_datetime(df['End Time'])-pd.to_datetime(df['Start Time'])
The format of the fields in the duration column is:
01:14:00
no date just a time lapsed in the format hh:mm:ss
to indicate time lapsed or 74 mins in the above example.
When I type:
df.Duration.dtype
dtype('m8[ns]') is returned, whereas, when I type
df.Duration.head(4)
0 00:14:00
1 00:16:00
2 00:03:00
3 00:09:00
Name: Duration, dtype: timedelta64[ns]
is returned which seems to indicate a different dtype for Duration.
How can I convert the format I have in the Duration column to a single integer value of minutes (time lapsed)? I see no methods that I can use, I'd write a function but wouldn't know how to treat the input of hh:mm:ss. This must be a common requirement of data analysis, should I be going about converting these dates and times differently if my end goal is to get a single integer indicating minutes lapsed? Should I just be using Excel?... because I have so far spent a day on this problem and it should be a simple problem to solve.
**update:
THANK YOU!! (Jeff and Dataswede) I added a column with the command:
df['Durationendminusstart'] = pd.to_timedelta(df.Duration,unit='ns').astype('timedelta64[m]')
which seems to give me the Duration (minutes lapsed) as wanted so that huge part is solved!
What still is not clear is why there were two different dtypes for the same column depending how I asked, oh well right now it doesn't matter.**

Resources