Average Conundrum
I have a need to create the sales report for a specific sales rep, but also to compare the performance to the average of all sales rep. Assume below is the raw data:
User Month Dollar
A Jan 100
B Jan 200
A Feb 200
B Feb 400
From the above, I need to get the below for user A
Month Dollar Average
Jan 100 150
Feb 200 300
I used a combination of FILTER & AVG functions, but could not get it done. The trouble is that I am getting average at the overall level & not at the month level. Any clues?
Thanks,
Dinesh.
Dinesh, in the measure column of your pivot table, if you click on the properties and then Aggregation Rule, you have a number of options, one of which is "average." There is also at the bottom of the window something that reads:
Report-Based Total (when applicable)
If this is not checked off, calculations are done off the whole report set; if checked off, then it is done only on the applicable rows. Here is the verbiage from the docs..
4 To specify report totals, perform the following actions:
■ To add a grand total for the report, click the Grand Totals button at the top of the workspace
and make sure the option Report-Based Total is selected.
■ To add totals for an individual column, click the Total By button for that column and make
sure the option Report-Based Total is selected.
The Total By button is available only for columns that can be totaled.
NOTE: If the option Report-Based Total is not selected, the Oracle BI Server will calculate the
total based on the entire result set, before applying any filters to the measures.
You can read about it here, chapter 6, beginning at page 100.
http://download.oracle.com/docs/cd/B40078_02/doc/bi.1013/b31767.pdf
You can also read this about level-based measures:
http://oraclebizint.wordpress.com/2007/12/03/oracle-bi-ee-101332-level-based-measures-lbms/
Similar Messages
-
Average & SUM in a Single criteria in the Pivot View
Hi,
Can you plese let me know whether it is possible to have SUM at the Grand Total level & Average on the Right Hand side of the Pivot Table view at the same time.
Thanks & Regards
Siva.Hi,
The way you want to do it is not possible.
What you can do is make a union of 2 reports one is using the Sum and the other the AVG and not use the Grand total provided by OBIEE.It's kind of creating your own Grand Totals
Look at this thread it will help:
http://obiee101.blogspot.com/2010/08/obiee-combine-with-similar-request.html
If you are using pivot table you can think about a new calculate item as a GT
http://varanasisaichand.blogspot.com/2010/12/aggregate-functions-on-grand-total.html
Best regards
Adil
PS: Please don't forget to close the thread and assign points when your question is answered
Edited by: adil.harrab on Jun 6, 2011 1:36 PM -
My video source is a 4 Mpixel (2k x 2k resolution) USB3 camera. This is displaying a live image OK in Labview at 45 fps using only 20% CPU. So far, so good.
I added a "IMAQ Resample" block to downsize this to 1024 x 1024 image. That works with almost no additional processing time if I select "Zero Order" interpolation (eg. plain subsample to value of nearest pixel). However, I want to average each 2x2 block (4 pixels) in the input image into 1 output pixel. I *think* that is the effect of selecting Bi-Linear interpolation. Doing that works, but takes about 45% of CPU. I want to do some other processing but am worried I will quickly run out of CPU time and start dropping frames.
Is there any better way to do this simple 50% downsize (2x2 average), that would take less CPU overhead, or is this the best way?Hi jbeale1,
In NI-MAX (Measurement & Automation Explorer) select your camera. Under the 'Acquistion Attributes' tab do you see an option to change the Video Mode of your camera to a different resolution? If your camera supports it, it would be more efficient to change the resolution there.
If not , here is a little more info regarding the IMAQ Resample VI:
http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_resample/
You are correct, the Bi-Linear option uses a more intensive interpolation technique which is why it is more taxing on your CPU. I hope this is helpful.
Robert S.
Applications Engineer
National Instruments -
I have a simple column chart grouping on 1 value on the category axis. For simplicity's sake, we are plotting $ amounts grouping by Month on the category axis. I right click on the data series and choose "Add calculated series...". I choose moving average. I want to move the average over at least 2 periods.
When I run the report, I get the error "Formula error - there are not enough data points for the period". The way the report is, I never have a guaranteed number of categories (there could be one or there could be 5). When there is 2 or more, the chart renders fine, however, when there is only 1 value, instead of suppressing the moving average line, I get that error and the chart shows nothing.
I don't think this is entirely acceptable for our end users. At a minimum, I would think the moving average line would be suppressed instead of hiding the entire chart. Does anyone know of any workarounds or do I have to enter another ms. connect bug/design consideration.
Thank you,
DanI was having the same error while trying to plot a moving average across 7 days. The work around I found was rather simple.
If you right click your report in the solution explorer and select "View Code" it will give you the underlying XML of the report. Find the entry for the value of your calculated series and enter a formula to dynamically create your periods.
<ChartFormulaParameter Name="Period">
<Value>=IIf(Count(Fields!Calls.Value) >= 7 ,7, (Count(Fields!Calls.Value)))</Value>
</ChartFormulaParameter>
What I'm doing here is getting the row count of records returned in the chart. If the returned rows are greater than or equal to 7 (The amount of days I want the average) it will set the points to 7. If not, it will set the number to the amount of returned rows. So far this has worked great. I'm probably going to add more code to handle no records returned although in my case that shouldn't happen but, you never know.
A side note:
If you open the calculated series properties in the designer, you will notice the number of periods is set to "0". If you change this it will overwrite your custom formula in the XML. -
Moving average price in case of goods receipt with free of charge
Hello everyone,
Need some inputs......
Sometimes we receive materials from suppliers free of charge (e.g. warranty replacement) u2013 moving average goes down u2013 worst case 0,01 EUR/piece. This causes problems in government reporting and export documentation EX1 and clearance/pro-forma invoice) for deliveries to field engineers (Order type ZIS1, ZIS3 u2013 item cat. ZICA), because moving average price is used for the values in government reporting and on the invoices. In government reporting and on invoices we need to state a true value of the part.On the other hand, the value warehouse stock is depending on the moving average cost as well.Could you please let me know, how to handle such receipts from the supplier to have a correct stock value and correct values on invoices and government reporting?
Thanks
Deepthi...Hello Deepthi,
It depends on your company policy. If you want to valuate the material along with the material purchased handled in moving average price, free consignment will bring down the MAP for the material.
In that case, you can revaluate the material to the original price in MR21 transaction.
If you are not going to handle the materials received free of charge along with the purchased material, you can go with another material code, with non valuated material type.
But i guess, no company will be asking for another material code. So go for revaluation after the receipt of free consignment.
Regards -
Query Scenario Help - Average of Multiple Regions
Hi, I have a query scenario I can't create and I hope someone can help with.
The user inputs a sales Area and the report is to output the regions in that area and provide the Volume (easy) and the Average of all the presented regions. The problem is that the number of regions is dynamic so I don't know how to go about determining the average and making it constant across the regions. The user can also drill down on a region to present divisions and I would then need the average for the divisions this time instead of regions. Can you help?
Example 1
Input Sales Area 1000000
Region 1000001 1000002 1000003
Product1 Volume 100 120 105
Product1 Average 108 108 108
Product2 Volume 200 400 325
Product2 Average 308 308 308
Example 2
Input Sales Area 2000000
Region 2000001 2000002 2000003 2000004
Product1 Volume 100 120 105 180
Product1 Average 126 126 126 126
Product2 Volume 200 400 325 600
Product2 Average 381 381 381 381
To get this layout I have the following in the query builder:
The 2 Products are in a structue under Rows
The Key figures structure is also under Rows
The Region is under the columnsIf you redesign the report slightly to move the "Average" to a column at the end of each row (which really makes more sense, IMHO), then the answer is easy. Just change the Suppress Results Row property to "Never" for Region, and change the Display Results As property to "Average" for Volume.
You could also make this same change to Division and/or any other free characteristic they might use as a drill-across in the report.
Hope this helps...
Bob -
SQL Query Help: Average of Sums !
Hi Folks !
I've been tasked with wirting a program that queries Oracle DB. And I'm not used to SQL a lot. May be my question is very basic. Please bear with me.
I've simplified the table structure for this question.
The table Order has 4 fields:
1. Order_id
2. Trial_No.
3. Response_Time.
4. Order_Time
Now the first two fields (Order_id, Trial_number) together make up the Primary Key (It is a composite key). My goal is to find the Average Response time for each Order ID in the past 10 minutes. Order_Time is the time at which Order was placed. An order can take more than one trail to complete the order. Order Reponse time is the sum of all the Trail response times.
A basic query like this
select AVG(Response_Time) from Order where Order_time < sysdate -10/1440.
gives me the Average of the response time but here is the catch : It produces the Average no matter how many trials the Order had. An order's response time is SUM of all the Trail Response times it had.
Consider the following data in the table
Order_id Trial_No Resopnse_Time (ms)
1 1 1000
2 1 1000
2 2 1000
2 3 1000
If I just use "select AVG(RESPONSE_Time), it will result in 1000ms. (4000/4).
But in reality, Order 2 had taken 3000ms to complete (3 trials). And the Avg Order Response time should be (1000+3000)/2 = 2000ms. Can you see it?
In other words, How do I calcluater the Avg of the sums of the rows, instead of Avg of all the rows. I've gone through some docs about 'group by' clause and 'subqueries', but don't seem to find the answer.
Thanks very much for reading such a long post. Looking forward to some guideance.
- KYou'll want some analytics on this:
SYS%xe> --select sum(sum_resp_time)/sum(rn) avg
SYS%xe> --from (
SYS%xe> with dataset as
2 (select 1 Order_id, 1 Trial_No, 1000 Response_Time from dual union all
3 select 2 , 1 , 1000 from dual union all
4 select 2 , 2 , 1000 from dual union all
5 select 2 , 3 , 1000 from dual
6 )
7 select order_id
8 , response_time
9 , row_number() over ( partition by order_id order by order_id) rn
10 , sum(response_time) over ( partition by order_id order by order_id) sum_resp_time
11 from dataset
12 -- ) where rn = 1;
ORDER_ID RESPONSE_TIME RN SUM_RESP_TIME
1 1000 1 1000
2 1000 1 3000
2 1000 2 3000
2 1000 3 3000
4 rijen zijn geselecteerd.
Verstreken: 00:00:02.15
SYS%xe> select sum(sum_resp_time)/sum(rn) avg
2 from (
3 with dataset as
4 (select 1 Order_id, 1 Trial_No, 1000 Response_Time from dual union all
5 select 2 , 1 , 1000 from dual union all
6 select 2 , 2 , 1000 from dual union all
7 select 2 , 3 , 1000 from dual
8 )
9 select order_id
10 , response_time
11 , row_number() over ( partition by order_id order by order_id) rn
12 , sum(response_time) over ( partition by order_id order by order_id) sum_resp_time
13 from dataset
14 ) where rn = 1;
AVG
2000
1 rij is geselecteerd.But you could do without them, as Raj showed.
( I guess this is one of my weirdest queries ;-) )
Edited by: hoek on Apr 7, 2009 6:17 PM -
Query to find out weekly average of job execution time
I have a table which has the following details:
CREATE TABLE JOB_DETAILS (JOB_START_DATE DATE,
JOB_END_DATE DATE,
JOB_START_TIME NUMBER,
JOB_END_TIME NUMBER,
HOURS_OF_EXECUTION NUMBER,
DETAILS VARCHAR2(20));
INSERT INTO JOB_DETAILS VALUES ('01-FEB-2007','01-FEB-2007',10.04,20.09,10.04,'WEEKDAY');
INSERT INTO JOB_DETAILS VALUES ('07-FEB-2007','07-FEB-2007',00.00,00.00,00.00,'WEEKEND');
commit;
Job_Start_Date Job_End_Date Job_Start_Time Job_End_Time Hours_Of_Execution DETAILS
1/2/2007 1/2/2007 10:04 20:09 10:04
1/7/2007 1/7/2007 0:00 0:00 0:00 Weekend
Our jobs wont run on week ends and on holidays where we see "Hours_of_execution" as 0.
Week means Monday to Friday for me.
(1) I want a query which gives me a weekly,monthly average of how many hours the job ran.
(2) I want to find out the week, when the average execution of the job is > 10 hours.
can anyone help in framing this query to get the details?
ThanksWhy make it so hard for yourself by removing the time from the date and storing it separately?
alter session set nls_date_format='DD/MM/YYYY HH24:MI:SS'
session altered
WITH t AS (SELECT SYSDATE start_date, SYSDATE+0.61 end_date FROM dual)
SELECT start_date, end_date, numtodsinterval(end_date-start_date,'DAY') execution_time
FROM t
START_DATE END_DATE EXECUTION_TIME
11/12/2008 11:22:21 12/12/2008 02:00:45 +00 14:38:24.000000 -
Exponential Moving Average - EMA - in PowerPivot
Hello All
We´re having a challenge trying to put the [20] (trading days) Exponential Moving Average (EMA) in our data model in PowerPivot.
Here is the EMA formula and sample spreadsheet:
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages
Pasted the formula here for convenience:
SMA (simple moving average): [10] period sum / [10]
Multiplier: 2 / ([Time period] + 1) )
EMA: {Close - EMA(previous day)} x multiplier + EMA(previous day).
Sample spreadsheet
http://stockcharts.com/school/data/media/chart_school/technical_indicators_and_overlays/moving_averages/cs-movavg.xls
In our model the fact table have these columns:
Symbol Date Open High Low Close Volume
And in the Calendar table we´ve identified the trading days (Calendar[TradingDayNumber]) as 1 so we can count them back.
We want the EMA calculated field in a pivot table like this
Filter context: a date selected on Calendar[FullDate]
Row context: FactTable[Symbol]
Values: FactTable[Close]
FactTable[EMA 20D] >> Missing
So far we got these calculated fields:
Period
=20
Ema Multiplier
=2 / ([Period] + 1)
Average 20D CLOSE
=IF([Sum of CLOSE]=BLANK(),BLANK(),(CALCULATE(AVERAGE(FactTable[CLOSE]),FILTER(ALL(Calendar),Calendar[TradingDayNumber]<=MAX(Calendar[TradingDayNumber]) && Calendar[TradingDayNumber]>MAX(Calendar[TradingDayNumber])-[Period]))))
But it looks like the EMA formula contains a self reference from previous values, and it also starts from a SMA (Average 20D CLOSE) value.
How can we do it?
Thanks in advance. I highly appreciate your support.Nico,
Is this still an issue?
Thanks!
Ed Price, Azure & Power BI Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it! -
Average filter but the image is gray and not color RGB
Hi,
i use this code for an average filter 3x3, the result is the image whit average but gray and not RGB color.... why??
thanks in advance
public void Average()
int values[]=null;
int input2d[] = new int [image.getWidth()*image.getHeight()];
int [][] output2d=new int [image.getWidth()][image.getHeight()];
image.getRaster().getSamples(0, 0, image.getWidth(), image.getHeight(),0,input2d);
for(int y=0; y < image.getHeight(); y++)
for(int x=0; x < image.getWidth(); x++)
int count = 0;
int average=0;
values = new int[5*5];
for(int s = 0; s < 5; s++)
for(int r = 0; r < 5; r++)
try
values[count] = input2d[(y-2+r)*image.getWidth()+(x-2+s)];
count++;
catch(ArrayIndexOutOfBoundsException e){ }
//trovo il valore medio dell'intorno 5x5
for (int temp=0; temp<count; temp++)
average+=values[temp];
int valpixel=average/count;
output2d[x][y]=valpixel;
image2 = new BufferedImage(image.getWidth(),image.getHeight(), BufferedImage.TYPE_INT_RGB);
image2.getGraphics().drawImage(image,0,0,null);
for(int y=0; y < image.getHeight(); y++)
for(int x=0; x < image.getWidth(); x++)
image2.getRaster().setSample(x, y, 0, output2d[x][y] );// componente R
image2.getRaster().setSample(x, y, 1, output2d[x][y] );// componente G
image2.getRaster().setSample(x, y, 2, output2d[x][y] );// componente B
}Can hel me please!!!
-
Acrobat Pro 6 Average Daily Production and Math.round problem
Acrobat Pro 6 Average Daily Production and Math.round problem
(Production.0) (154) (whole units) . (Production.1) (90) (fractional) / (divided by) 31 (days) results in (Average.0) (4)(whole units) . (Average.1) (10) (fractional) using :Math.round.� Noticed that 154 (whole units) . 85 through 99 (fractional) also show 4.10. (without Math.round : 5.00)
Method:
�Production.0� (whole units) . �Production .1� (fractional) / Days = (Average Daily Production) (�Average.0� (whole units) . (Average.1) (fractional)
� Production.0 (value not calculated)�, � Production 1 (calculated) (event.value = util.printx("0099", (event.value)).substr(-2,2); � �Average.0 (value not calculate)�, and �Average.1 has following calculation:
var punits = this.getField("Production.0");
var pfrac = this.getField("Production.1");
var average = 0.0;
average = (punits.value + pfrac.value / 100) / this.getField("Days").value;
this.getField("Average.0").value = average - average % 1;
this.getField("Average.1").value = util.printx("0099", Math.round((average % 1 * 100))).substr(-2,2);
�Math.round� appears to be a problem. Also, could you explain the purpose of �0099� . Anyway, why would 154.85 through 154.90 divided by 31 give 4,10. Also, their must be a better way, to find the average daily production. All you have to do is divided the production (whole. fractional) by the days, and display the average daily production as (whole. fractional). Any suggestions??There are a many loose ends in your question.
First, I have never seen before a variable type called 'var'. Is it a java primitive or a class?
Next, I cannot seem to find any class that has the printx method.
When it comes to substr(-2,2), I get confused. First, I thought that it was a method of the String class, but I only got as far as substring(beginIndex, endIndex).
If you really must break the production and average into pieces, try this:
float average = (punits + pfrac/100) / days;
int avg_units = (int)average;
int avg_frac = (int)( (average - avg_units) * 100 );My guess is that util.printx("0099", x) formats x having two optional digits and two mandatory digits, showing 0-99 as 00-99, but allows to show numbers with three and four digits.
154.85/31 = 4,9951612903225806451612903225806
154.99/31= 4,9996774193548387096774193548387
If you round the fraction of theese numbers multiplied by 100 ( = 99.51.. and 99.968...) you get 100, and this will be the output of printx. My guess for "4.10" is that substr(-2,2) returns the two first characters of the string, because the start index should not be zero. (According to java docs, substring throws an exception on a negative index, so what kind of class are you really using ??????) -
Calculating Percent totals and Averages in SSRS
Below is a report created using SSRS. I want to be able to calculate the percentage(%) total to add up to 100 % in the Total column. For some reason my averages are not working as you can see from the table. The idea is to calculate the averages of opportunities
as well as Sold. But from my calculation, things are not adding up as I supposed. This report is not grouped by parent. How do I make this to work as it should? Thank you.
(NB: Please zoom in to view the image)
ZionliteHi,
According to the description, I doubt you may manually add Total and Averages columns. Did you manually add Local and International or they were in a column group?
You can use the following expression for the Opportunity Cost(averages) column in the total row:
=Sum(Fields!opportunitycost.Value)/2
How did you calculate the percentage column? If it is Sold value divided by Opportunity Cost value, use:
=Sum(Fields!sold.Value)/Sum(Fields!opportunitycost.Value)
Also try to define the scope in the expression and see if it make difference.
If there is no progress, please capture the screenshot of your design tab.(Click on the report and capture the image of your report structure)
Also, tell us the expression of the text box which in problem.
Thanks.
Tracy Cai
TechNet Community Support -
Report to show average days it takes customers to pay their invoices
I am wondering if there is a report in SAP that can help me determine the average days it takes customers to pay their invoices?
Hi,
Try this for date range
declare @from as datetime
Declare @to as datetime
Set @from = /* Select min(T5.DocDate) from OINM T5 where T5.DocDate= */ '[%0]'
Set @to = /* Select max(T6.DocDate) from OINM T6 where T6.DocDate= */ '[%1]'
Select A.CardCode, A.CardName, Avg(A.Diff) [AverageDays] from
(SELECT T2.[CardCode], T2.[DocEntry],
T2.[CardName], max(T2.DocDate)[Inv], max(T0.DocDate) [Pay],
datediff(dd, max(T2.DocDate), max(T0.DocDate)) [Diff]
FROM ORCT T0
INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocNum
inner join OINV T2 on T1.DocEntry = T2.DocEntry
where T2.DocDate between @from and @to
Group by T2.[CardCode], T2.DocEntry, T2.[CardName]) A
Group by A.CardCode, A.CardName
Regards,
Bala -
How to calculate Average balance for an account
Hi,
How to calculate average balance for an account for a particular period say for JAN-12 period and after the end of that period for another two days 01-feb-12 and 01-feb-12 ?
I'm using the following query :
SELECT cc.segment1||'-'||cc.segment2||'-'||cc.segment3||'-'||cc.segment4||'-'||cc.segment5||'-'||cc.segment6 "Account_XX",
nvl(sum(l.accounted_dr - l.accounted_cr),0) "Balance"
FROM gl_code_combinations cc,
gl_je_lines l
WHERE cc.code_combination_id = l.code_combination_id
AND l.set_of_books_id ='XX'
and code_combination_id = replace it with code combination_id for account_xx
AND l.effective_date <= '31-Jan-12' (january period end ??)
GROUP BY cc.segment1||'-'||cc.segment2||'-'||cc.segment3||'-'||cc.segment4||'-'||cc.segment5||'-'||cc.segment6
There are some discrepancies in "average balance" after end of month (Jan-12)?
How to calculate average balances for a particular account (Account_XX above)from end of month of Jan to first two days of february?
Thanks,
KiranKiran,
Please let me know first, is Average Balancing feature enabled in your GL Ledger?
Regards
Muhammad Ayaz -
Average of the column in ALV report
Hi,
I am working on an ALV report and for one of the column, i am calculating the average with fieldcatalog property do_sum = 'C'.
I am sorting the output table for 2 fields and whenever I am expanding/compressing the sorted fields the average of the column is changing. Please let me know how do I get this average calculated constant. It should not change when the user collapses/expands on the sorted field.
Regards
RashmiThe same question has been asked in this thread:
Compute average of a report column
I have offered a solution but as I've said it's not great but it may meet your needs.
Or another forum user may review and be able to suggest a better solution.
Does the average need to be part of the report?
Could you calculate it and display it within a page item below the report instead?
Maybe you are looking for
-
Since mountain lion my MBP won't import RAW or jpg files
my MBP won't import RAW or jpg files. Worked fine before. Could it be Mountain Lion?
-
What have I done differently here?
Here is my landing page for my site ifamg.com. The "yellowish" section, bottom right half of the page, has 2 links: the book graphic and the "click here" text. The book link (when I'm viewing this in Firefox) opens up a new window to show my Store (
-
HT1338 Why will my mac not do a software update
Why will my mac not do a software update
-
Installing Oracle iLearning....Need Help!!!!
Anyone know what I need to install to get Oracle iLearning working on Windows 2000? Any help is needed and appreciated.
-
Backup-GPO -All, can this be filtered?
Hi guys, I'm using the following to backup all the GPO's in the domain: $Backups = Backup-GPO -All -Path $SubBackupFolder -Domain $DomainFQDN -Comment "Add comment here" However, I do not want to backup all the GPO's. I want to backup only about 20 G