Does Cognos Framework Manager has the "Last" function like Dynamic Cubes in Cognos? - business-intelligence

I was wondering if Cognos Framework Manager has the built-in function "Last" like in Dynamic Cubes?
Or does someone know how to model following case:
We have two dimensions - a time dimension with year, half-year, quarter and month and another dimension that categorises people depending how long they are attending a project (1-30 days, 31-60 d, 60-180, 180 -365, 1-2 years, +2 years). However the choice of the time dimension level (year, half-year etc.) influences the categorization of the other dimension).
An example:
A person attends a project starting from 15.11.2018 and ends 30.06.2020. The cognos user uses for the time dimension the year level thus 2018, 2019 & 2018 will be displayed.
For 2018 the person will be in the category 31-60 days, since 46 days have passed until 31.12.2018. For 2019 the person will be listed in category 1-2 years as 46 + 365 days will have been passed since 31.12.2019. For 2020 the person will also be in that category as 46 + 365 + 180 day have gone by.
The categories will change if the user selects another time dimension level e.g. half-years:
2nd HY 2018: 31-60 (46 days passed)
1st HY 2019: 180-365 days (46 + 180 --> End of HY2019)
2nd HY 2019: 1-2 years (46 + 180 + 180)
1st HY 2020: 1-2 years (46 + 180 + 180 + 180)
Does someone know how to model dynamic dimension categories based on selection of another dimension (here time dimension)?
The fact table contains monthly data and for the mentioned peroson above there will be 20 seperate records (for each month between november 2018 and june 2020).

For any period, a person may or may not be working on a project.
Without knowing exactly what your data and metadata is it would be somewhat difficult to prescribe an exact solution but the approach would probably be somewhat similar to a degenerate dimension scenario.
You would want to model the project dimension as a fact as well as a dimension. You would have relationships between it and time and whatever other dimensions you need.
Depending on the data and the metadata you might need to do some gymnastics to get there.
If the data was in a form similar to this it would be not too difficult. This is an example to get you an idea about some ways of approaching the problem.
Date_Key Person_Key Project_Key commitment_status, which would be the measure.
20200101 1 1 1
20200101 1 2 0
20200101 1 3 0
20200102 1 1 1
20200102 1 2 0
20200102 1 3 0
20200103 1 1 0
20200103 1 2 1
20200103 1 3 0
In the above, person 1 was working on project 1 for 2 days and then put onto project 2 for a day. By aggregating the commitment status, which is done by setting the aggregate rule property, you would be able to determine the number of days a person has been working on a project no matter what time period you have set in your query.

Related

schedule algorithm for minimal contact time and group size for my child's daycare

Given the new legal regulations due to covid-19 the daycare of my child and all involved parents are overwhelmed and we need to come up with a schedule of when which child can be cared for.
Given the demanded care time per child (s. below), We need an algorithm to optimize the following:
Minimal total contacts / fixed groups. If children meet, it is best if they stay in that group and do not see children of other groups.
While point 1 is more important, the 2nd prio would be to reduce the size per group or maybe it should be phrased as minimal count of different children met per child
Even less important: reduce total contact time.
(Maybe there are other requirements, that I overlooked?)
The demands are of following nature (Timespan and type) :
Case
Child
Timespan
Type
(1) Fixed time, Required
1
Monday, 8:30 - 13:00
Required
(2) Fixed time, nice to have
1
Tuesday, 8:30 - 13:00
Nice to have
(see (1))
1
Tuesday, 13:00 - 16:00
Required
(see (1))
1
Thursday, 8:30 - 13:00
Required
(see (1))
2
Monday 8:30 - 13:00
Required
(3) Flexibel date, required
2
Any 2 other days 8:30 - 13:00
Required
(4) Flexibel date, nice to have
2
Any day 13:00 - 16:00
Nice to have
(5) Flexibel datetime, Required
3
3 hours
Required
(6) Flexibel datetime, Nice to have
3
3 additional hours
Nice to have
...
...
...
Required = The child must have daycare
Nice to have = daycare is demanded but not required. E.g. if child 1 meets child 2 and 3 on Monday and Thursday, it would be fine to meet the same children on Tuesday morning as well, but if it is a completely different group of children than this would not make sense.
All provided timespans must stay in one continuous piece (meaning that 3 hours cannot be split up into multiple slots).
Additional Information
There is only one room available.
There are 15 children in total.
If a solution is much better than the other it is ok-ish to violate "Required" demands for a few cases. We might be able to find a different solution for the parents in few situations. The algorithm should hence contain a parameter like maxAllowedViolations - let's say it's 3 and it should compare how much the solution is better than without the errors.
The demand is provided per week and might change from week to week. I only know the demand one week in advance. The ideal grouping hence might change per week, but it might be better to respect the grouping of the last week as a guidance, because corona has about 7 to 10 days of incubation time.
The caregivers are tested for covid-19 twice a week, the children are not.
I do not care in which language or pseudo-code-ish way the algorithm is, but I will try to implement the algorithm in a web-based format so other daycare centers can use it as well.

Irregular intervals - where to draw a line?

I have a line chart ( x represents date, y represents amount of car rentals on that date) that needs to be connected at all times, since the values are all valid - there is always at least one car rental per that date. The only time that the line shouldn't be connected, but should make a gap between two valid values/points is when the two successive dates are too wide apart. I have to figure out the best alghorithm for what this 'two wide apart' means and, based on these dates (or something), set a parameter.I don't know all the possible combinations of dates, but I think they can be anything:
2010 2011 2013 2018 2019
or
1990 2001 2002 2012 2015
or
possibly anything else
Is there any standard way to deal with this kind of problem?
The problem is to characterize what it means to be too wide apart. One solution is to build a histogram (i.e. a probability density function) of the date differences of the x coordinates of the data points, and then to consider as too wide, those differences that are in, say the top 33% (or whatever other proportion you wish).
For example, suppose the x coordinates are the years:
1990 1995 2001 2002 2003 2010 2011 2012 2013 2017 2019
Let say we calculate date differences in years (we could choose any other duration unit). We calculate the differences between the values above and build the histogram below.
Counts: 5 1 0 1 1 1 1
Diff.: 1 2 3 4 5 6 7
Now, if we choose to keep disconnected differences in the top 33%, from the histogram, this means that differences greater than or equal to 5 years would be disconnected.

How can I use SumProduct Function in SSRS?

I have three columns in a SSRS table which record telephony data
Row 1 is Calls Offered which is a straight count
Row 2 is Calls Answered is as above
Row 3 is a Service Level Percentage of Calls Answered/Calls Offered
This table spans for 9 months and then there is a total column at the end
Row 1 and Row 2 are easy enough because it's just a grand total but for Row 3
I need to do a weighted average for all the percentages across the 9 months
So how can I do a SUMPRODUCT which will give me the weighted average service level over 9 months
In Excel my formula is as follows: =SUMPRODUCT(E10:M10,E$8:M$8)/SUM(E$8:M$8)
So Row 8 is my calls offered and Row 10 being my percentages - how do I replicate this in SSRS?
Thanks
Dan
I've worked out if anyone is interested it was
=(Sum(Fields!Calls_Answered.Value)/Sum(Fields!Calls_Offered.Value)) * Sum(Fields!Calls_Offered.Value)/Sum(Fields!Calls_Offered.Value)
So it has to do the calculation of the service level percentage first then times that against the amount of calls offered and then divide it against the amount of Calls Offered
Thanks
Dan

Crystal Reports Sort by difference of sub groups

I'm looking for a way to sort a group by the difference of it's sub Groups
For example, Ticket is a group, Week is a group under ticket,
Ticket A : Total 100 Tickets, Difference 10 tickets
Week 1 : 55 Tickets
Week 2 : 45 Tickets
Ticket B : Total 100 Tickets, Difference 30 tickets
Week 1 : 65 Tickets
Week 2 : 35 Tickets
Ticket C : Total 150 Tickets, Difference 70 tickets
Week 1 : 110 Tickets
Week 2 : 40 Tickets
So basically, I want to determine the difference between the 2 groups, then sort by that. I can create the formula simple enough, but it won't let me sort by it. Any ideas
Do you have direct access to the database? For example, if this is a SQL database, I would create a stored procedure that creates the calculations for each group. Then when you add the stored procedure to the report you could easily sort them.
Some functionality is easier to produce on the db side instead of Crystal.

Finding similarities in a multidimensional array

Consider a sales department that sets a sales goal for each day. The total goal isn't important, but the overage or underage is. For example, if Monday of week 1 has a goal of 50 and we sell 60, that day gets a score of +10. On Tuesday, our goal is 48 and we sell 46 for a score of -2. At the end of the week, we score the week like this:
[0,0]=10,[0,1]=-2,[0,2]=1,[0,3]=7,[0,4]=6
In this example, both Monday (0,0) and Thursday and Friday (0,3 and 0,4) are "hot"
If we look at the results from week 2, we see:
[1,0]=-4,[1,1]=2,[1,2]=-1,[1,3]=4,[1,4]=5
For week 2, the end of the week is hot, and Tuesday is warm.
Next, if we compare weeks one and two, we see that the end of the week tends to be better than the first part of the week. So, now let's add weeks 3 and 4:
[0,0]=10,[0,1]=-2,[0,2]=1,[0,3]=7,[0,4]=6
[1,0]=-4,[1,1]=2,[1,2]=-1,[1,3]=4,[1,4]=5
[2,0]=-8,[2,1]=-2,[2,2]=-1,[2,3]=2,[2,4]=3
[3,0]=2,[3,1]=3,[3,2]=4,[3,3]=7,[3,4]=9
From this, we see that the end of the week is better theory holds true. But we also see that end of the month is better than the start. Of course, we would want to next compare this month with next month, or compare a group of months for quarterly or annual results.
I'm not a math or stats guy, but I'm pretty sure there are algorithms designed for this type of problem. Since I don't have a math background (and don't remember any algebra from my earlier days), where would I look for help? Does this type of "hotspot" logic have a name? Are there formulas or algorithms that can slice and dice and compare multidimensional arrays?
Any help, pointers or advice is appreciated!
This data isn't really multidimensional, it's just a simple time series, and there are many ways to analyse it. I'd suggest you start with the Fourier Transform, it detects "rhythms" in a series, so this data would show a spike at 7 days, and also around thirty, and if you extended the data set to a few years it would show a one-year spike for seasons and holidays. That should keep you busy for a while, until you're ready to use real multidimensional data, say by adding in weather information, stock market data, results of recent sports events and so on.
The following might be relevant to you: Stochastic oscillators in technical analysis, which are used to determine whether a stock has been overbought or oversold.
I'm oversimplifying here, but essentially you have two moving calculations:
14-day stochastic: 100 * (today's closing price - low of last 14 days) / (high of last 14 days - low of last 14 days)
3-day stochastic: same calculation, but relative to 3 days.
The 14-day and 3-day stochastics will have a tendency to follow the same curve. Your stochastics will fall somewhere between 1.0 and 0.0; stochastics above 0.8 are considered overbought or bearish, below 0.2 indicates oversold or bullish. More specifically, when your 3-day stochastic "crosses" the 14-day stochastic in one of those regions, you have predictor of momentum of the prices.
Although some people consider technical analysis to be voodoo, empirical evidence indicates that it has some predictive power. For what its worth, a stochastic is a very easy and efficient way to visualize the momentum of prices over time.
It seems to me that an OLAP approach (like pivot tables in MS Excel) fit the problem perfectly.
What you want to do is quite simple - you just have to calculate the autocorrelation of your data and look at the correlogram. From the correlogram you can see 'hidden' periods of your data and then you can use this information to analyze the periods.
Here is the result - your numbers and their normalized autocorrelation.
10 1,000
-2 0,097
1 -0,121
7 0,084
6 0,098
-4 0,154
2 -0,082
-1 -0,550
4 -0,341
5 -0,027
-8 -0,165
-2 -0,212
-1 -0,555
2 -0,426
3 -0,279
2 0,195
3 0,000
4 -0,795
7 -1,000
9
I used Excel to get the values. But the sequence in column A and add the equation =CORREL($A$1:$A$20;$A1:$A20) to cell B1 and copy it then up to B19. If you the add a line diagram, you can nicely see the structure of the data.
You can already make reasonable guesses about the periods of patterns - you're looking at things like weekly and monthly. To look for weekly patterns, for example, just average all the mondays together and so on. Same goes for days of the month, for months of the year.
Sure, you could use a complex algorithm to find out that there's a weekly pattern, but you already know to expect that. If you think there really may be patterns buried there that you'd never suspect (there's a strange community of people who use a 5-day week and frequent your business), by all means, use a strong tool -- but if you know what kinds of things to look for, there's really no need.
Daniel has the right idea when he suggested correlation but I don't think autocorrelation is what you want. Instead I would suggest correlating each week with each other week. Peaks in your correlation--that is values close to 1--suggest that the values of the weeks resemble each other (I.e. are peiodic) for that particular shift.
For example when you cross correlate
0 0 1 2 0 0
with
0 0 0 1 1 0
the result would be
2 0 0 1 3 0
the highest value is 3, which corresponds to shifting (right) the second array by 4
0 0 0 1 1 0 --> 0 0 1 1 0 0
and thenn multiplying component wise
0 0 1 2 0 0
0 0 1 1 0 0
----------------------
0 + 0 + 1 + 2 + 0 + 0 = 3
Note that when you correlate you can create your own "fake" week and cross-correlate all your real weeks, the idea being that you are looking for "shapes" of your weekly values that correspond to the shape of your fake week by looking for peaks in the correlation result.
So if you are interested in finding weeks that are close near the end of the week you could use the "fake" week
-1 -1 -1 -1 1 1
and if you get a high response in the first value of the correlation this means that the real week that you correlated with has roughly this shape.
This is probably beyond the scope of what you're looking for, but one technical approach that would give you the ability to do forecasting, look at things like statistical significance, etc., would be ARIMA or similar Box-Jenkins models.

Resources