Parsing RRule results wrong occurrences for this specific case - icalendar

Last instance of daily & monthly recurring not fetching properly, while same case works fine for weekly recurring.
I have saved the recurring pattern of events in DB, but when I fetch from DB and set events properties and called event.GetOccurrences(). I have events for 1,2,3,4 Aug but when rule is parsed(i.e after calling event.GetOccurrences()) it gives 4 instances with 1st aug repeated twice so we have occurrence for 1,1,2,3 Aug with 4 Aug got missed.
For Daily recurring meeting
FREQ=DAILY;COUNT=4;BYHOUR=13;BYMINUTE=30;BYSECOND=0
The above pattern gives instances as 1 Aug,1 Aug, 2 Aug, 3 Aug, gives 4 instances but 4 Aug missed and 1 Aug repeated twice, after this I set time in these instances.
For Weekly recurring meeting
FREQ=WEEKLY;COUNT=4
When above pattern is parsed by same function then it gives 4 instances of correct date, after that I set time for these occurrences from DB.

I have done a workaround. I have reset BY Hour, Minute and Second.
RecurrencePattern recurringPattern = new RecurrencePattern(recurringRule);
if (recurringPattern.Count > 0)
{
recurringPattern.ByHour = new List<int>();
recurringPattern.ByMinute = new List<int>();
recurringPattern.BySecond = new List<int>();
}
calendarEvent.RecurrenceRules.Add(recurringPattern);

Related

SAP Business Objects - Calculating services activity across months

I have a requirement to calculate a persons total activity, for each month that they have activity. I'll give a couple of examples to demonstrate my needs:
Client A - Service starts 15th April and ends 5th June. They are scheduled to receive 7 hours per week of activity.
Client B - Service Starts 15th April and ends 20th April. They are scheduled to receive 14 hours per week.
Given the above I would want a table that shows the following:
Clients
April Hrs
May Hrs
June Hrs
Client A
16
31
5
Client B
10
Total Activity
26
31
5
Currently we are having to calculate each month individually and stack up the table with each months data. Is there a way to generate this calculation across months, taking into account the start dates, end dates, and commissioned hours activity per week and calculate the actual received activity in each month?
Thanks in advance!

Table Calculation In Blended Data Sources

I have 2 data sources:
1) Eligible Devices to be changed to a newer model
2) Devices actually changed to a new model
These could be for example computer devices which are after a certain time required to be changed to a newer version i.e. end of life of a product.
As this is a blended data source, so i cannot apply an LOD.
The calculation i am trying to achieve is:
Jan 2017: There are 100 eligible devices but actually only 85 got refreshed. hence there are 15 device which are carried forward to the next month
Feb 2017: There are 200 eligible devices but actually only 160 got refreshed, plus 15 from Jan 15 so the total opening bal for Feb = 200 + 15 = 215 and then 160 to be deducted i.e. 55.
The same process will continue for all the other months and year.
The challenge:
Lets say by actual - eligible is named as Diff. This number should only take actual - eligible for the first month. from second month onward it should take actual - eligible and then the balance from previous month i.e. look up
How do i write a calc which only shows the calculation as described above for first month and then a look up + actual - eligible from previous month from next month onwards.
There would be month and year columns in filters, if i remove any year or month filter, the carry forward from that period will not be accounted for.
Sounds like Running_Sum([Diff]) ahould do the trick as long as you set the partitioning and addressing correctly.

Need to display monthly data excluding 2 months of data

Im trying to design a dashboard wherein I need a parameter to control 2 things.
If I select "Rolling 12", I should be able to see the last 12 months of my data with respect to current month. When I select "Rolling 12-2", I should be able to see
last 12 months of my data but excluding the latest 2 months. E.g If I'm in January 2018 then I should be able to see data excluding Jan 18 and Dec 17 (from Jan 17 to Nov 17). I have tried some techniques but without success. Can anyone help. Thanks.
Reference Tableau Workbook attached at link :
Using the Superstore sample data (I don't have 10.5 installed), I created the following boolean expression which you'd put in the filter shelf for True.
Give a parameter called rolling, create calc field as follows:
if [rolling] = 'Rolling 12'
then DATEDIFF('month',[Order Date],{max([Order Date])}) < 12
ELSEIF [rolling] = 'Rolling 12-2'
then DATEDIFF('month',[Order Date],{max([Order Date])}) < 12
and DATEDIFF('month',[Order Date],{max([Order Date])}) >= 2
end
Adjust the date name for your date field.

TABLEAU Calculating a Running DISTINCT COUNT on usernames for last 3 months

Issue:
Need to show RUNNING DISTINCT users per 3-month interval^^. (See goal table as reference). However, “COUNTD” does not help even after table calculation or “WINDOW_COUNT” or “WINDOW_SUM” function.
^^RUNNING DISTINCT user means DISTINCT users in a period of time (Jan - Mar, Feb – Apr, etc.). The COUNTD option only COUNT DISTINCT users in a window. This process should go over 3-month window to find the DISTINCT users.
Original Table
Date Username
1/1/2016 A
1/1/2016 B
1/2/2016 C
2/1/2016 A
2/1/2016 B
2/2/2016 B
3/1/2016 B
3/1/2016 C
3/2/2016 D
4/1/2016 A
4/1/2016 C
4/2/2016 D
4/3/2016 F
5/1/2016 D
5/2/2016 F
6/1/2016 D
6/2/2016 F
6/3/2016 G
6/4/2016 H
Goal Table
Tried Methods:
Step-by-step:
Tried to distribute the problem into steps, but due to columnar nature of tableau, I cannot successfully run COUNT or SUM (any aggregate command) on the LAST STEP of the solution.
STEP 0 Raw Data
This tables show the structure Data, as it is in the original table.
STEP 1 COUNT usernames by MONTH
The table show the count of users by month. You will notice because user B had 2 entries he is counted twice. In the next step we use DISTINCT COUNT to fix this issue.
STEP 2 DISTINCT COUNT by MONTH
Now we can see who all were present in a month, next step would be to see running DISTINCT COUNT by MONTH for 3 months
STEP 3 RUNNING DISTINCT COUNT for 3 months
Now we can see the SUM of DISTINCT COUNT of usernames for running 3 months. If you turn the MONTH INTERVAL to 1 from 3, you can see STEP 2 table.
LAST STEP Issue Step
GOAL: Need the GRAND TOTAL to be the SUM of MONTH column.
Request:
I want to calculate the SUM of '1' by MONTH. However, I am using WINDOW function and aggregating the data that gave me an Error.
WHAT I NEED
Jan Feb March April May Jun
3 3 4 5 5 6
WHAT I GOT
Jan Feb March April May Jun
1 1 1 1 1 1
My Output after tried methods: Attached twbx file. DISTINCT_count_running_v1
HELP taken:
https://community.tableau.com/thread/119179 ; Tried this method but stuck at last step
https://community.tableau.com/thread/122852 ; Used some parts of this solution
The way I approached the problem was identifying the minimum login date for each user and then using that date to count the distinct number of users. For example, I have data in this format. I created a calculated field called Min User Login Date as { FIXED [User]:MIN([Date])} and then did a CNTD(USER) on Min User Login Date to get the unique user count by date. If you want running total, then you can do quick table calculation on Running Total on CNTD(USER) field.
You need to put Month(date) and count(username) in the columns then you will get result what you expect.
See screen below

How can I schedule bi-weekly jobs?

My app requires users to schedule recurring events that can recur daily, weekly, monthly, or bi-weekly.
By bi-weekly, I mean every fortnight (14 days) starting from an arbitrary date value provided at the time of creation.
My jobs table has two columns to support this: job_frequency_id and job_frequency_value. I'm able to schedule all types except for bi-weekly.
The first col is an FK to the job_frequencies table; it contains daily, weekly, monthy, bi-weekly values. The job_frequency_value contains the value corresponding to the frequency.
For example: If a job has a job_frquency_id == 3 and job_frequency_value == 10, it will run every 10th day of the month.
How do I add bi-weekly support without tampering with my db structure? I will use the job_frequency_value col to store the start date of the 14 day period, but I'm unsure of the calculation going forward.
Say your starting date is stored as a variable named 'createdDate'.
nextFortnight = DateAdd("ww", job_frequency_value*2, createdDate);
can you wrap your scheduled task in a and set it to run every week?
Something like
<cfif DateDiff('ww',CreateDate(2011,01,01),Today'sDate) MOD 2 EQ 1>
That way if the weeks are odd your scheduled task runs completely and if it's an odd week then it runs the scheduled task, but ignore all your code.