Cumulative sum by bins in obiee - obiee

I want to generate a report in obiee , by grouping countries and showing there cumulative sum
I tried creating bins like for china I created a bin which contains singapore, taiwan and china. another bin for japan containing some countries. using pivot table i can show the sum of customers in a region by dates for these two bins. but when I need a cumulative sum for every bin it is giving weird values
Number of employee by region and date where china and japan are bins
china japan
01-Nov-18 1 3
02-Nov-18 2 4
03-Nov-18 1 1
04-Nov-18 2 5
05-Nov-18 4 7
06-Nov-18 5 7
where as result i want( how can I achieve this)
China Japan
01-Nov-18 1 3
02-Nov-18 3 7
03-Nov-18 4 8
04-Nov-18 6 13
05-Nov-18 10 20
06-Nov-18 15 27

The measure has to be a running sum in that case. RSUM(YourMeasure)

Make a duplicate layer of the measure column. Click on the duplicated column and select the option 'Display as Running Sum'.

Related

AWS Quicksight - How do I group by sum and then average?

I've just started using Quicksight and I can't for the life of me figure this out.
Let's say I have a table that goes like this :
date
country
color
nb_sales
10-11
USA
Black
10
10-11
USA
Blue
5
10-12
USA
Blue
20
10-11
UK
Black
10
10-12
UK
Black
15
10-11
UK
Blue
15
What I want is the average daily number of sales by country, preferably in a pieplot :
country
avg_nb_sales
USA
17.5
UK
20
So I need first to group by date, country and sum the ratings and then once this aggregation is done I need the average by country. I thought I should be using avgOver(sum(ratings), country) but I can't get it right.
So how do I achieve that ?
I thank you for your time.
I have managed to get the result expected though not sure that it is the best way to do it (especially if you have some dates when you get sales only for one country):
avgOver(sum(sales), [country])/distinct_count(date)

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

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.

Algorithm to group people by two factors

I have thought long about this but couldn't figure it out. I am looking for an algorithm ( in any language) to group a bunch of people by the following these 2 rules:
Group by ascending skill level which is represented by a number (the higher the more skilled). The best and weakest in the group should not differ by more than 1 point, where possible.
Spread out people from the same country as far as possible, i.e. dont put people from the same country in the same group, while at the same time not breaking rule 1 above. A group should not consist of people from 1 country where possible.
Each group can have at most 4 person (where possible) or 3 persons e.g. if there are 18 people, then they are split into 3 groups of 4 and 2 groups of 3.
Sample data (Skill level followed by country) :
5 US
5 US
5 US
5 US
6 GB
6 GB
6 GB
7 CN
7 CN
7 CN
7 CN
7 HK
8 US
8 US
8 US
8 CA
8 CN
8 CN
..to be grouped into 2groups of 4s and 2groups of 3s
Please help if you have any idea?
thank you in advance
I would suggest the following.
First, aggregate the data by country and skill level, so the data looks more like:
US 5 4
GB 6 3
. . .
Sort this by the highest ranking first.
Then use a greedy algorithm.
Determine the number of members in the group (either size or size - 1)
Take one from the first group (highest ranking).
Continue taking one from each subsequent group meeting the country condition (so you might need to skip the US).
That defines the first group.
Then repeat.
This is not guaranteed to be optimal. But then again, optimality is not defined for the problem. Which is more important? Country diversity or skill sameness?

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

Exporting related tables from Access to one Excel worksheet

I am trying to set up an Access database and will be importing the data from Excel. We do our analysis in R and the current Excel worksheet we use is formatted and arranged to work well for exporting to R and doing analysis there.
The format is as follows:
The first 12 columns of data describe date, location and other information which then applies to the following 12 columns. The trouble is that for a single set of observations the information in the first 12 columns doesn't change from row to row but the values for the second 12 columns does change from row to row.
year mm dd loc start end obs sess test object success
2013 5 15 park 1600 1700 MTM MTM1 1 ball y
2013 5 15 park 1600 1700 MTM MTM1 2 stick y
2013 5 15 park 1600 1700 MTM MTM1 3 rock n
2013 5 15 park 1600 1700 MTM MTM1 4 rock n
2013 5 15 park 1600 1700 MTM MTM1 5 stick y
2013 5 15 park 1600 1700 MTM MTM1 6 stick y
2013 6 24 yard 1500 1530 LFR LFR1 1 ball n
2013 6 24 yard 1500 1530 LFR LFR1 2 stick n
2013 6 24 yard 1500 1530 LFR LFR1 3 stick n
2013 6 24 yard 1500 1530 LFR LFR1 4 stick n
2013 6 24 yard 1500 1530 LFR LFR1 5 stick y
2013 6 24 yard 1500 1530 LFR LFR1 6 rock y
2013 6 24 yard 1500 1530 LFR LFR1 7 ball y
Above is an imaginary dataset which matches the format of the real one (the real one is too wide to fit here).
Notice that the entries for year, mm (month), dd (day), loc (location), start, end, obs (observer), and sess (session) all stay the same but test, object, and success change from row to row for a given set of observations.
In Access I would like to use a unique_ID (primary key) to relate tables so that the information for the first 8 columns need only be entered once and have it relate to each entry for the last 3 columns. In this example then, I have one Excel worksheet that will become two related Access tables (objects).
Before converting to Access though I would like to know that I will be able to export the data back to Excel (and/or directly to a text file) so that it will look just like this again. That is, I do NOT want to export multiple tables to separate Excel worksheets. I want all Access tables within my database to be exported to just one worksheet and in the format shown above. The reason for this is that we run analysis in R based on both the session and the instance levels (called different things in the real data, but that is the idea) so it is important for the location data and result data to be associated with every row in the output file (.xls or .csv).
Is this possible?
I am mostly looking for an outline of how this might be done. Specific code is not necessary, though your personal assessment of the complexity of the potential code (given my complete and absolute ignorance of VBA) that will be required would be appreciated.
The answer appears to be Yes. I just need to create a Query which will return the data to the original form and then export that query as a table.

Resources