How to calculate an average for each quarter in a year
Hello worldI have a table that stores all the unit tests for the data. I'm figuring avg unit tests that have been recorded by quarter in one year
I tried with avg and the meter, but I'm sure that the results returned are not perfect
Help me in this scenario.
Thank you
Sriks
user10699584 wrote:
so if there are 10 unit tests then the avg is 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10/10
It is a weird way to definig average. Anyway, why:
2005-2 Q 5 2.5
According to your package:
(1 + 2 + 3 + 4 + 5) / 5 = 3
not 2.5. I'll assume that it's a typo. Now based on Mathematics:
1 + 2 + 3 +... + n = (1 + n) * n / 2
The foregoing your 'average' would be:
(Count + 1 / 2)
Also, I suspect tc_vts column data type is DATE, if so:
select to_char(tc_vts,'YYYY-Q"Q"') "year-Quarter",
count(*) "Total cases",
(1 + count(*)) / 2 "Average of total cases"
from Testcycl
group by to_char(tc_vts,'YYYY-Q"Q"')
order by "year-Quarter"
/
SY.
Tags: Database
Similar Questions
-
Many storage spaces and data for each quarter of the year files
Hello
I am junior DBA and I have a question about tablespace partitioning or data file sharing.
I have a database of 10g in many storage spaces, for example:
KER_DATA_2009_Q1
KER_DATA_2009_Q2
KER_DATA_2009_Q3
KER_DATA_2009_Q4
KER_INDX_2009_Q1
KER_INDX_2009_Q2
KER_INDX_2009_Q3
KER_INDX_2009_Q4
There is also a data file for each tablespace that is mentioned.
But for this year 2013, only two big storage space I can get one and data KER_DATA, KER_INDX files.
All tables and indexes in the whole database are KER_DATA, KER_INDX, tablespaces.
I don't know any cut in two storage spaces and means of data files. Is this something like tablespace partitioning? This can be done automatically or someone needed to do it manually on the end of each quarter?
This should be done to improve performance, several small files data instead a large?
Can some admin explain this to me?
The reason for this separation of database/tablespace was partitioning. There are a lot of tables partitioned by date column, and there are partitions for each quarter of the year. There are tablespace with a data file for each quarter (partition).
-
calculate an average for each record
Hello
what I want is: I have a table
SCHOOLBOY (id, first_name, last_name,...)
and another table
BRANDS (id, schoolboy_id, discipline_id, mark, mark_type). a schoolboy
on a discipline (math, for example), a schoolboy may have more points. I want to calculate the average mark, but for every schoolchild. then, for example I want to generate a report that contains the first name, the family name of the schoolboy and nearby, the average of the marks.
How can I calculate the average of all brands for every schoolchild ?
Thank you!
Edited by: Roger22 06.06.2009 at 01:43Maybe something like:
SELECT first_name, last_name, b1.avg_mark FROM schoolboys a1, ( SELECT schoolboy_id, AVG (mark) avg_mark FROM marks WHERE discipline_id = 4 -- specify whatever discipline_id you want GROUP BY schoolboy_id) b1 WHERE a1.id = b1.schoolboy_id /
Kind regards
JOEdit: Corrected the Code tags
-
Hi all! This code works great, it returns the average value for contragentid = 1. So correct result is LUAHPER = 14996837,94
But when I add the values for contragentid = 2 (see commented strings), my statement returns incorrect result LUAHPER = 5497801,81
How can I improve my code in order to calculate the average for each contragentid?
Edited by: 858774 14/06/2011 02:29with t as ( select to_date('12.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,14275303.54 as luah, 214275303.54 as lusd from dual union all select to_date('14.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,14275303.54 as luah, 214275303.54 as lusd from dual union all select to_date('15.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,14275303.54 as luah, 214275303.54 as lusd from dual union all select to_date('16.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15274795.50 as luah, 215274795.50 as lusd from dual union all select to_date('17.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15431807.40 as luah, 215431807.40 as lusd from dual union all select to_date('18.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15480730.00 as luah, 215480730 as lusd from dual union all select to_date('21.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15480730.00 as luah, 215480730 as lusd from dual /*union all select to_date('12.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,214275303.54 as luah, 214275303.54 as lusd from dual union all select to_date('14.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,214275303.54 as luah, 214275303.54 as lusd from dual union all select to_date('15.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,214275303.54 as luah, 214275303.54 as lusd from dual union all select to_date('16.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215274795.50 as luah, 215274795.50 as lusd from dual union all select to_date('17.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215431807.40 as luah, 215431807.40 as lusd from dual union all select to_date('18.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215480730 as luah, 215480730 as lusd from dual union all select to_date('21.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215480730 as luah, 215480730 as lusd from dual*/ ) select contragentid, sum(luahper) / cnt as luahper from ( select contragentid, (lead(arcdate,1,date '2011-03-20' + 1) over(order by arcdate) - arcdate) * luah luahper, date '2011-03-20' - date '2011-03-13' + 1 cnt from ( select arcdate, contragentid, luah, lusd from t where arcdate > date '2011-03-13' and arcdate <= date '2011-03-20' union all select greatest(arcdate,date '2011-03-13'), contragentid, luah, lusd from t where arcdate = (select max(arcdate) from t where arcdate <= date '2011-03-13') ) ) where contragentid = 1 group by contragentid, cnt
Hello
858774 wrote:
But when I add the values for contragentid = 2 (see commented strings), my statement returns incorrect result LUAHPER = 5497801,81I guess that's because you don't join and partition on contragentid.
This appears to do:Scott@my10g SQL>/ CONTRAGENTID LUAHPER ------------ ---------- 1 14996837.9 Scott@my10g SQL>l 1 with t as ( 2 select to_date('12.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,14275303.54 as luah, 214275303.54 as lusd from dual 3 union all 4 select to_date('14.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,14275303.54 as luah, 214275303.54 as lusd from dual 5 union all 6 select to_date('15.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,14275303.54 as luah, 214275303.54 as lusd from dual 7 union all 8 select to_date('16.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15274795.50 as luah, 215274795.50 as lusd from dual 9 union all 10 select to_date('17.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15431807.40 as luah, 215431807.40 as lusd from dual 11 union all 12 select to_date('18.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15480730.00 as luah, 215480730 as lusd from dual 13 union all 14 select to_date('21.03.2011','dd.mm.yyyy') as arcdate, 1 as contragentid,15480730.00 as luah, 215480730 as lusd from dual 15 -- 16 union all 17 select to_date('12.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,214275303.54 as luah, 214275303.54 as lusd from dual 18 union all 19 select to_date('14.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,214275303.54 as luah, 214275303.54 as lusd from dual 20 union all 21 select to_date('15.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,214275303.54 as luah, 214275303.54 as lusd from dual 22 union all 23 select to_date('16.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215274795.50 as luah, 215274795.50 as lusd from dual 24 union all 25 select to_date('17.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215431807.40 as luah, 215431807.40 as lusd from dual 26 union all 27 select to_date('18.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215480730 as luah, 215480730 as lusd from dual 28 union all 29 select to_date('21.03.2011','dd.mm.yyyy') as arcdate, 2 as contragentid,215480730 as luah, 215480730 as lusd from dual 30 -- 31 ) 32 select contragentid, sum(luahper) / cnt as luahper 33 from ( 34 select contragentid, (lead(arcdate,1,date '2011-03-20' + 1) over(partition by contragentid order by arcdate) - arcdate) * luah luahper, 35 date '2011-03-20' - date '2011-03-13' + 1 cnt 36 from ( 37 select arcdate, contragentid, luah, lusd 38 from 39 t 40 where arcdate > date '2011-03-13' 41 and arcdate <= date '2011-03-20' 42 union all 43 select greatest(arcdate,date '2011-03-13'), 44 contragentid, luah, lusd 45 from 46 t 47 where arcdate = (select max(arcdate) from 48 t t2 49 where arcdate <= date '2011-03-13' 50 and t.contragentid=t2.contragentid) 51 ) ) 52 where contragentid = 1 53* group by contragentid, cnt Scott@my10g SQL>/ CONTRAGENTID LUAHPER ------------ ---------- 1 14996837.9
858774 wrote: How can I improve my code in order to calculate the average for each contragentid?
When I remove the 'where contragentid = 1' seems to do with above query:
Scott@my10g SQL>/ CONTRAGENTID LUAHPER ------------ ---------- 2 214996838 1 14996837.9
-
How to make a model for a quarter fold card
How to make a model for a quarter fold card - horizontal and vertical format
HI Mickey,
Check the file > new file selector model to see if your version of Pages offers card models. This began as a two "single fold" card on US letter in landscape orientation.
The model included three pages. Page 1 Page 2 inside, outside, and the third was a blank page. Only Page 1 was included in the original document.
I started by the insertion of a page inside, containing two of the big text box below.
Back to Page 1, I chose an image returned vertically then horizontally, then repeated this procedure with the text box that contains "Thank You".
I traced the two objects, then moved inside page, placing the pair in the upper left corner.
Inside page, I removed the text in the box on the left and replaced by "left inside,"a label to mark the position of this section in the final map. "
I added a text box, entered 'Back' returned vertically then horizontally and dragged to the position shown.
Save the result as a model.
Using the same document, I went to file > layout and changed the landscape to Portrait orientation.
Do drag the blue guides to the indicated positions, then reshape the elements to fit the new space.
Save the result as a model (with a different name of the above registered version).
Kind regards
Barry
PS: Executed using Pages ' 09.
-
Filtering and calculate the averages for subsets of a table
I have a 2D picture that comes out of a loop, and I need to calculate the average of the subsets corresponding to iterations 0-9, 10-19, etc... In addition, I need to filter the values above and below acceptable limits before calculating the average. Any suggestions for how to address the issue?
Here are examples of code does exactly that. This post, looks like you need an upper limit as well. I'll leave that as an exercise for you.
-
Average for a quarter and the grand total amount
Hi all
I have a report (PivotTable) in which I view information about sales. I have category, subcategory in the rows. Quarter of the year in the columns. Sales are loaded at the day level in the fact table. My report must indicate the average quarterly sales. That is to say that all sales per month should be added to the top and sales 3 months should be on average to get the average of quarterly sales. We must show the total sales for each category sub. We must also show the % of sales for each subcategory with a category.
I did the following,
1. the aggregation of the column in the SPR Sales is basically
2. in the report, I shot months in the criteria and which excluded the pivot
3. I changed the aggregation (for total rum) for the SUM of criteria-> the column formula
4. I changed the AVG aggregation to view measures pivot
5. I have reproduced the measure to display the percentage of its sales
6. I enabled total in the lines.
Everything works well except the value of the subtotal of sales which gives me the average of subcategories at the level of the category, instead of this, it must be a sum. The % of total is correct where he gives 100% for each category
Please help me reach the sum to the total sub level
Thank you!
Concerning
Deepak
Hey, I just fixed the problem myself. The solution was to write the formula as AVG (sales per quarter, category, subcategory), then change the rule of the aggregation in short.
-
How to measure the time for each mapping?
I use oracle11g with OWB.
I have several mapping and each dimension tables to update the mapping.
I want to measure how long it takes to complete each mapping. What is the best way to find the total time for each mapping.
One way is, we can have POST MAPPING and PROCESS of MAPPING PRE. I can trigger the stored procedure to enter the start time and the end time of each match. On this basis, I can calculate the total time for each mapping. But I have 50 mapping. Now, I need to write 50 different stored procedure and open the POST-PROCESSING of the MAPPING and PROCESS OF MAPPING of the PRE for each mapping. It is complex.
Is there another way, we enter the total for each mapping of execution? Y at - it that no data in OWF_ MGR dictionary can help on this?
I would be grateful if someone can help me on this.He will remain forever unless you purge it explicitly.
See you soon
Katia -
How can I custom ringtone for each SIM card in acer z630s
How can I custom my ringtone for each sim card?
I've tried doing as
Settings - Sound - ringtone - sim1 (set the ringtone of my default system card SD for each sim)
Although the rings ringtone as the default value.
Thanks for the suggesion,
But after the second time of the system update notification, it works automatically, that I put the ringtone for individual sim card.
problem has been resolved.
-
How can I assign partial credit so that for each possible answer 6 out of 10 each correct answer gets 10 points each, with a possible total score of 60 points quiz?
To Captivate 7, please go to the Quizzing workspace. You will have the properties and properties Quiz Panel visible. I will now repeat the workflow, I explained briefly for CP7:
- Check the partial score in the Quiz properties and also multiple responses.
- Indicate the correct answers on the stage
- Select the first correct answer on the stage text caption and indicate its score (10pts) in the properties panel, not in the Quiz properties!
- Repeat the same for each correct answer
- Check the total score in the properties of the Quiz Panel: should now be 60pts to the full question.
None of the quiz system variables can be changed, they are read-only. System variables in Captivate 6 - Captivate blog explains the system variables for 6 categories, there are a few changes in 7: new features of Captivate 7.01 - Captivate blog but the Quiz category is always read-only.
-
How to add vertical gripper for each TableRow in a TableView?
I am looking for a better approach / best practices to accomplish this task. I need to be able to implement, for the less resizable (sliding on a dividing line) TableRow. I understand that this is a little more difficult to maintain the height of each individual TableRow because they are virtual and reused. My first goal is to have all TableRow resized (eliminating the need for individual line sizes).
I am able to set up my own TableRow expanding TableRow - and I managed to retrieve a reference to the skin of the TableRow and adding a line of separation (Rectangle) and capture mouse events to effectively resize the row height by dragging.
My Question is this: without implementing a new TableRowSkin - how can I force the line of separation at the bottom of the TableRow? Currently - I just added the node Rectangle (divider) to the list of children of the TableRowSkin - causing the dividing line be positioned on top of TableRow (which gives a vibe when resizing - the line should be on the bottom).
I feel I'm hacking at the question without being aware of the intention of the JavaFX developers. The intention of the row height resizes to be implemented by providing a new skin? It doesn't seem to be an easy way to accomplish this task using the existing TableRow or TableRowSkin.
I can post the code if requested example - but I'll need to condense the example of a small enough standalone file.
If the answer is Yes - "put in place a new skin" that's fine, but this task can be difficult without the source code of advice :) [Tip... Tip..]Hi jkaufmann,
If you want to add the vertical panel resizable on every row then you need to implement the cellFactory() for each cell in columns.
There are a few steps that makes this possible:
D ' apply the cellFactory for all columns. You can addListener for the ObservableList of TableView.getColumns ().
-Add resizable Panel either rectangle or someone you like then check setCursor (Cursor.V_RESIZE) for this Panel. To make the rectangle/node always thoroughly and then use BorderPane layout
-Now add a few events on Rectangle/node
-create two variables: start, end
-setMouseClicked (help to set the starting value: position of y)
-setMouseDragged (change the cell height according to the change in y ie. end-start.) And also update the end value according to the current position of y)
-setMouseReleased (Finally, reset to 0 for the start and end value)-Now add a few lines and test them. It works smoothly
Hope this will give you some tips
Thank you.
Narayan -
How many profiles is there for each camera?
When I develop my Nikon D700 raw files, I have the choice of a number of profiles such as Adobe Standard, camera Vivid, Portrait of camera neutral camera and different modes of DX2.
However, with the raw files from my Olympus E - P1, I see only one profile; - Adobe Standard.
None of the E - P1 as Vivid modes, silent, natural or Monotone seem to be emulated by Adobe.
Is that correct and how do I know which profiles Adobe has actually produced for each camera?
Ian
Is that correct and how do I know which profiles Adobe has actually produced for each camera?
Yes, not all cameras have camera-specific profiles. For the most part it is Canon and Nikon and a few others. Take a look at yto our camera raw profiles directory, you will see all of the profiles here. On Vista, you can find it here C:\ProgramData\Adobe\CameraRaw\CameraProfiles\Camera.
-
How to count the records for each region day and conditional
Hello
I need to create a report where I list activities for a month and the number of specific Type for each days activities. something like below
Number of days in the month where Type = 'A' Count where Type = B
January 1, 2009 2 3
January 2, 2009 7 6
January 3, 2009 8 7
----
-----
January 31, 2009 4 6
I tried with the creation of conditional region for each row of table for every day, but it does not work. I use below for conditional region-
<? xdofx:If substr (to_date ('20': substr (Planned, 9, 2) |)) » -'|| substr (Planned, 1, 2). » -'|| (substr (Planned, 4, 2), 'MM-DD-YYYY'), 4, 2) = 01? > <? Planned? > <? end if? >
But it is not functional and do not know how to count records in the table for each date as well.
Can anyone help in it as soon as possible. I'm quite new to BI.
ThnksYou can mark it as resolved... :D
Kind regards
Colectionaru -
How to choose different sounds for each contact
It is possible to select the notification sound for each contact email name?
You can set different sounds for ringtone and messages for each contact independently of the contacts application change a contact and then set the tone that you want under the header of message or ring.
For email, you can set a single sound of the sounds settings section. It is not possible to set different sounds for notifications by e-mail.
-
How to print 1 page for each line of the numbers worksheet
Hello... I am trying to print reports of year-end per person and number.
Is it possible in number to print 1 page for each row of a spreadsheet of numbers?
Or suggestions?
Thank you.
Hi cm,
This looks like a work of fusion and mailing.
The merge document would create in Pages, and the cells of merger on this document référenceriez cells in the table in the document numbers.
See the documentation Pages (on the Help menu) for instructions on the conduct of merger and mailing.
To do this in only numbers, you would need to put in place a 'table of declaration' on a separate sheet (in the same document as the table containing information) which would accept a customer number (or other key ID for each individual) then use it to determine the line of the main table to retrieve information about this pattern.
A more precise answer requires a more specific desription of your table structure and the desired form of the instruction to take.
Kind regards
Barry
Maybe you are looking for
-
The certificate is not reliable because no sender string has been provided
There is a thread archived with this question in many responses, however, there is no explanation as to why this error is thrown on some systems and not on others and on FireFox and not on Safari, Chrome, IE, FireFox (on Mac). Not on all Windows syst
-
I want to change the text of the URL in a bookmark. When I manually enter the URL in the address bar of Firefox, the site takes me immediately to the secure login page, but he remembers the URL at which I entered. I can't 'bookmark this page' because
-
Satellite 3000-601: driver sound has only the .inf file - how to install?
Hi all!I have a problem with these phones. After the new installation Win XP SP2 (no recovery disk) sound on :((.) Driver from the official website of Toshiba won't help. File "Setup", is not necessary the driver *. INF. Your answers?PS. Sorry for my
-
Tracing of the three variables
Hello! I use an XY graph to draw a series of time as well as measurement data. However, I want to include a third variable in the plot. This variable is a constant (straight line), but the XY graph does not accept more than two variables? No idea how
-
Switch Acer 10 nothing will come on the screen
my switch 10 acer screen would turn but nothing he will have dark after that I took in and not just light stay would appear on button / stop? What should I do to get it to turn on?