Average Value
Dear all,
i have to calculate a query which contains the following data
¦ Day 1 ¦ Day 2 ¦ ... ¦ Day 7 ¦ Avg. week ¦ Avg. month ¦ Avg. year ¦
Value 1
Value 2
In Colum 1 to 7 the daily revenue should be displayed; in the column Avg. week i should show the daily average (sum of clumn 1 to 7 / 7). that's easy. but how should i calculate the monthly average or the yearly average ?
i don't want to create 365 columns in the query to calculate just a average for the year? I tried with key figures with exeptionel aggregation (AVG) but that does not help. If i have daily data loads i have the same values in this key figure as in the others (of course).
Any idea ?
If preferred I could provide an Excel-File. Perhaps it is then easier to understand.
Thanks,
Marc
Hi Marc,
Create a structure:
in first object restrict revenue by calday and offset calday
(a user entry variable) by 6 ( ex if calday is 08/11/07 u will get revenue for 08/05/07)
similarly do it 6 more time with offsets descending untill 1 and in the last object no offset which will give you the present day( as entered in the variable 0calday)
now create a formula object avg week ( sum of all above columns /7)
now create another object for month(you can hide this if you want by hding it funder properties) : here restrict revenue by variable 0calmonth
now create a formula object and use the above field value and calculate average using the available mathematical functions
similarly do it for a year also (0fiscyear)
Hope this helps
Anand Raj
Similar Messages
-
To display average value in a graph
Hi There,
In one graph I need to display the duration for each week as per the week range selected and a separate average duration value of the weeks selected.
Is it possible to develop a query for above average value and use this query in WAD?
Can anybody help in providing a solution
Thank you
AnimaBI Query data can be fed directly to WAD Charts.
See below.
http://help.sap.com/saphelp_nw04/helpdata/en/0c/95c83956852b51e10000000a114084/content.htm -
Too many decimals in Average value
Hi
I am using Report Builder and the wizard do design a table which i deploy as a .jsp page.
For some columns in the table I select to display the average values. Some of the values looks fine with one decimal as i want, but some values is displayed with a lot of decimals (about 10) as 164,346666666666666666. I have tried to change the length but without effect. Are there any possibility to decide the number of digits to be shown in the report . Or is i it a bug in Report Builder.Go to Property Inspector of the field and choose the right "Format Mask".
-
Creating function to calculate average value
Hi,
The below query was successfully return an average value. It returned 1 row.
SELECT AVG(Volume)
FROM security
WHERE
Type = 'Future' AND
Rating = 'AAA' AND
Code = 1 AND
(Day = ''14-mar-09' OR
Day = '16-mar-09' OR
Day = '');
I tried to use that function on my created function below.
CREATE OR REPLACE FUNCTION fn_Vol_Average
( v_DayLast_1_Week IN DATE,
v_DayLast_2_Week IN DATE,
v_DayLast_3_Week IN DATE )
RETURN NUMBER IS
v_Vol_Average NUMBER;
BEGIN
SELECT AVG(Volume) INTO v_Vol_Average
FROM security
WHERE
Type = 'Future' AND
Rating = 'AAA' AND
Code = 1 AND
(Day = v_DayLast_1_Week OR
Day = v_DayLast_2_Week OR
Day = v_DayLast_3_Week);
RETURN NVL(v_Vol_Average, NULL);
END;
I called that function by the following query. it was work, however it return the whole rows. It looks like the function perform the average calculation of each rows on the table.
Can anyone help me what is going on with the logic?
select fn_Vol_average('14-mar-09','16-mar-09','')
from security
--But since your function calculates the average over the whole security table, you wouldn't call this from a select statement which also reads the security table.
You just want to execute it once.
declare
l_vol_average number;
begin
l_vol_average := fn_Vol_average('14-mar-09','16-mar-09','');
dbms_output.put_line(l_vol_average);
end;By the way, be careful with your date parameters. You should use TO_DATE with a proper format mask to prevent conversion errors. -
Display of "Average Values Text in ALV grid"
Hi
I use ALV grid to display the fields from a table. I have 15 columns. I need to do average for four columns.
In the field catalog i did a do_sum for those fields.
When the ALV grid is displayed I get average values for these columns.
Eg. Let suppose the grid looks like
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
35 18 16 52 24
My requirement is I need to display the text "AVERAGE VALUES" . ( I need something like this.)
Field1 Field2 Field3 Field4 Field5 Field 6.
vendor1 18 22 6 17 28
vendor1 54 11 16 62 28
vendor1 33 21 26 79 18
Average values 35 18 16 52 24
Could someone help me in this?
Thanks & Regards
KavithaHello,
you can use event subtotal_text of ALV_GRID.
Regards,
Pedro Santos -
Calculate Average value based on Day ??
Hello,
I am trying to calculate the Average value based on a day. The data is presented as follows...
Day SOCount
Mon 34
Mon 56
Mon 67
Tues 24
Tues 25
Tues 23
Weds 45
Weds 69
The issue im having is that the Day column needs to be grouped first and the SOCount sumed together. Then the Average SO Count needs to be calculate based on this.
ThanksThanks for the reply,
The solution you have provided only gives me the average of the count of the SO Count, not the actual average of all the values added together then divided by the count..
The report i am creating only has charts in it. So i am trying to create a chart showing the
Average Sale Order Value by day.
I should have metioned this from the start, sorry.
Is it possible to do ?
Edited by: davitali on Nov 4, 2011 6:32 AM -
Script logic to calculate average value on nodes - SAP BPC NW 10.0
Hi experts,
I need to have in the parent members of the dimension TIME (2014.Q1, 2014.Q2, 2014.Q3, 2014.Q4, 2014.TOTAL) the average value of their children and not the sum. For example :
2014.01 2014.02 2014.03 2014.Q1
1 2 3 2
2 = AVG(1, 2, 3)
I tried the script bellow but it doesn't work , it throws the error " ReferenceError : AVG is not defined"
*SELECT(%TIMESET%,"[ID]",TIME,"[CALC]='Y'")
*XDIM_MEMBERSET TIME = %TIMESET%
*XDIM_MEMBERSET MEASURES = PERIODIC
*WHEN DIM1
*IS C02
*WHEN TIME
*IS %TIMESET%
*REC(EXPRESSION = AVG(Descendants([%TIMESET%].CURRENTMEMBER)), TIME = %TIMESET%)
*ENDWHEN
*ENDWHEN
*COMMIT
How can I achieve this ?
Thanks
MahaThe best way is to enter 2 accounts: Productivity and Area, calculating by dimension member formula:
ProductivityPerHectare=IIF([Area]=0,NULL,[Productivity]/[Area])
If you have to enter ProductivityPerHectare and Area, then in script you can calculate Productivity:
*WHEN ACCOUNT
*IS Area
*REC(EXPRESSION=%VALUE%*[ACCOUNT].[ProductivityPerHectare],ACCOUNT=Productivity)
*ENDWHEN
*WHEN ACCOUNT
*IS ProductivityPerHectare //user input
*REC(EXPRESSION=%VALUE%*[ACCOUNT].[Area],ACCOUNT=Productivity)
*ENDWHEN
Then dimension member formula:
ProductivityPerHectareCalc=IIF([Area]=0,NULL,[Productivity]/[Area])
You can use arithmetic average of ProductivityPerHectare only if Area is always constant.
In this case you can create some dummy account member DUMMY and fill it with 1:
*WHEN ACCOUNT
*IS ProductivityPerHectare //user input
*REC(EXPRESSION=1,ACCOUNT=DUMMY)
*ENDWHEN
Then dimension member formula:
ProductivityPerHectareCalc=IIF([DUMMY]=0,NULL,[ProductivityPerHectare]/[DUMMY])
Vadim -
How to calculate average value?
Hi all,
I'm using Lumira 1.15. I'm doing some practices with the sample dataset BestRunCorp... I want to calculate the average value of gross margin which is grouped by lines so that I can use a line chart to show the difference between the gross margin value and average value.
How can I achieve this ?
Best regards,
ShuangIt looks like it calculates the average based on the dimension
See below:
If you take the "Best run" Excel file, sort by country, calculate the average in Excel, it matches Lumira's 4,056 (for Argentina)
I am not sure I follow your divide by 12 logic? -
the data I measured changed rapidly, so i want get the average value of the data
Do not tell me to use mean.vi , i have already know that.
and i got an idea which is add the data into an array every time, then sum of all the data value and take the result divide by the number of elements
but i dont know how to achieve that, anyone can build a simple vi to show me ? thank you
i have attached my vi which is using mean.vi to calc the average value, you can delete it and using in your way , thank you !
Solved!
Go to Solution.
Attachments:
EN-new.vi 274 KBHi I got a similar issue for averaging. I used the mean.vi from the math function but the average is rolling when i run it. I am trying to calculate the average for the data i read to the RT FIFO (which is around 40000 lines).I got the writing part working, however, when i am reading the data, I couldn't get it working. I thought i read the data as a 1-D array, and then pass it to the Mean.vi and then got the result. But seems like the mean is only showing the last data in the array.
Can someone help me with this??
Attachments:
FPGA-vi.png 242 KB
RT-vi.png 182 KB
RT-2mod.vi 515 KB -
Read-in CSV and Calculate Average Value
I've got a csv file which I'm reading in but need to calculate the average value of the second column (CPU). It's in the following format:
Date CPU
01/09/2014 25.3
02/09/2014 22.3
03/09/2014 26.2
04/09/2014 22.1
I basically need the average CPU for the month. Any advice?
Thanks in advance
Adam"Date","CPU"
"01/09/2014","25.3"
"02/09/2014","22.3"
"03/09/2014","26.2"
"04/09/2014","22.1"
'@ | sc test.csv
(Import-Csv test.csv | measure CPU -Average).Average
23.975
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " " -
Hi
In my query I am unable to average the values in the query is there a way of getting number of records in the query please tell me how to get average values in the query level i went to properties i found the average option but that does not work.
Regards,
Nikhil.Hi Nikhil,
Try with the solution detailed in the following document:
www.service.sap.com/bi --> Product Information Previous Releases --> Media Library --> HOW TO... Guides --> Guide List SAP BW 2.x --> How to... Count the occurrences of a characteristic.
Ciao.
Riccardo. -
Hello
How to make labview program to get average value of 200 reading from multimeter (I using using loop) to read voltage from mulmeter but I like to get average value of all of 200 reding how can I do that?
Thanks
Wee
Solved!
Go to Solution.Another idea with less programming - take advantage of the "free" array that comes with a Chart - i.e. the History Data.
1) Wire your DMM data to a Chart. (You can set the chart to invisible if you don't plan on using it in the GUI).
2) Set the Chart History Length to 200 (right click on the chart, click on Chart History Length...)
3) On the block diagram, use the History Data Property Node, wire it to Mean.vi, and you're done.
Easiest running average ever.
Message Edited by Broken Arrow on 04-07-2010 11:36 AM
Richard
Attachments:
EasyAvg.jpg 8 KB -
I'm trying to take a few readings from an oscilloscope. I made a simple VI to test all of the parameters for the oscilloscope and make sure that everything was working before implementing the oscilloscope in a much more elaborate VI. I want to have voltage at a certain level (say, 2 V) then take a reading from the oscilloscope, add that value as a new element in an array. After doing this 100 times the VI will add the average value to a spreadsheet and then increase the voltage (to 2.05 V or something) and take 100 more measurments and average/record them. I was able to take ten sets of 100-sample averages and write them to an array (see notbroken.png) on one file, but when I try to do it in the real program (see broken.png) I check my spreadsheet and each entry is "0.000." Note that I've also created a program that controls the power supply independently and verified that I know how to control it properly; in fact, the only non-zero column is the one which reads the voltage that the program is telling the power supply to output.
I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
Solved!
Go to Solution.
Attachments:
broken.png 53 KB
notbroken.png 42 KBvweltin wrote:
I've literally written out each step that my "not broken" program does to find the average value and then done the same for the broken program and I can't find a single discrepancy. Any and all help would be greatly appreciated!
Here's an exact analysis.
Both of your programs are broken, but the one with the FOR loop iterates only 10 times, thus you get arrays with one nonzero value (the last one) when the loop terminates. (Just because the average is nonzero, does not mean it is correct!)
Your code with the while loop iterates 11 times, but your array only has 10 elements, meaning that in the last iteration you try to replace an element that does not exist and the array remains at all zeroes.
In both programs, there will never be more than one non-zero element in the array.
LabVIEW Champion . Do more with less code and in less time . -
Average value for waveform chart
Hello everyone.
Can i make a time interval, where i can measure average value for a waveform chart ?
for example fom 0:30 to 0:45
I have uploadet my VI
Thanks in advance
Oesen
Best regards
Oesen
Solved!
Go to Solution.
Attachments:
Trykmaaling.vi 83 KBOesen,
When you are displaying data on a chart, the newest data is appears at the right of the previous data. When the chart history buffer is full (default length = 1024), adding a new point deletes the oldest point. Visually it appears that the data slides to the left as new data is added to the right end.
My question relates to how the user would "tell" the program what data to average. In the image you posted you marked a segment of the data to be averaged. Suppose the user marks point "A" as the beginning of the segment. While the user is deciding where to put mark "B" additional data is acquired and point "A" disappears because it is beyond the history length. What does the program do in such a case? A slight variation is the situation where both "A" and "B" have been marked but some of the data is deleted from the history before the averaging or other processing has begun.
Lynn -
Averaging values of multiple signals seperately
Hi All,
I am attempting to create a VI that will average data over a user defined amount of time (via boolean switch). The attached vi collects data once the "collect Data" switch has been triggered, when the test is over the user triggers the "average collected data" switch to get an averaged value. Please see attached VI.
THis vi works fine for a single signal. However, the ultimate goal is to be able to do this whole process for n-number of sensors throughout my test loop with a final output as an excel file.
I am pretty sure that I can get the data saved for an excel file but I cant figure out how to get all of the signals averaged seperately and placed into an array.
Any help will be much appreciated!
Thanks,
Stefan
Attachments:
Average Collected Data.vi 13 KBStefan,
When you are doing the multiple signal process, will the collection time and averaging be done for all signals simultaneously or will there be separate Collect and Average controls for each channel?
If all channels will be done simultaneously, you can probably just make your arrays 2D with each channel in a different column. Each iteration of the loop will store the data in the next row (if Collect is True).
Notes on your VI: 1. You do not need the sequence structure. Dataflow controls when things happen. Your VI will work the same without it.
2. The two case structures wired to Collect Data could be combined into one.
3. Building an array inside a loop results in frequent memory reallocations. As the array gets large this will cause the program to slow down and will fragment memory. A better approach is to allocate memory outside the loop with Initialize Array and use Replace Array Subset inside the loop where the Build Array primitives are now. You will need to add another shift register to keep track of the next index to replace.
4. Loops should usually have a time delay to prevent them from grabbing all the available CPU cycles. Once you put in a real data acquisition process, that may provide the delay.
Lynn -
Hi,
I have a problem. I'm reading data continuously from analog input. I want calculate average value when I press button START. Average value should be calculated from samples which are defined by 'Number of samples' and 'millisecond multiple'. When all samples are read, average vale should show.
The problem is that when number of samples is higher then 10, it doesn't work.
Can someone tell me what I did wrong?
Thanks
P.S.. I saw that there was something like this but I can't open it because I use Labview 8.5
Attachments:
Average.vi 35 KBFor that you need to store the previous value for averaging... i have attached a VI regarding that ( sorry no time to cleanup ).. You can use the logic to calculate the average of the samples (Still am not clear about you requirement).
The best solution is the one you find it by yourself
Attachments:
Average_anand.vi 26 KB
Maybe you are looking for
-
How to display different subtotal text for each group in alv report
Hi, i need to display subtotal text as "totals of Mat1" for material numbers 1 to 10 as group1 and again i need to display subtotal text as " totals of Mat2" for material number 11 to 20. group 2. Please help me asap.
-
I'm having troubles transfering two new playlists I just created on my new MacBook Air to my iPhone 5. I have some music on my iPhone that isn't on my MacBook yet and I don't want to lose the music on my iPhone. How do I just transfer the playlists?
-
Difference between RDA delta and normal Delta
Hi All I have some doubts regarding the RDA [Real Time data Acquisition] process I am aware that RDA enables us to get the data every minute with help of Daemon process.What is the diffrence between th delta mechanism that is followed in RDa and no
-
Hoping to get some helpful hints and a working example atl file. We have been able to establish the connection between Business Objects Data Services and the WSDL service provider by defining the data store. The functions available as part of the WS
-
Inner Exception The provider is not compatible with the version of Oracle
I am using the 64 bit ODP and Net 2.0 SDK in a C# program which runs standalone and is also hosted by another win32 process. When running standalone it works ok. But when being hosted by another process, I get the following exceptions thrown when i c