How to calculate mean value of a matrix
Hi... I ve one matrix of order (m*n). I need to calculate the mean value of this matrix. How to do this?
let we consider the matrix as 4x4.(Row=Column=4) The resultant matrix i.e mean value matrix is 1x4(Row=4,Column=1). To read the row value simultaneously in order to calculte the mean value thro row.... ? please help me out
Example:
Matrix A=1 2 3 4
5 6 7 8
1 3 5 7
2 4 6 8.
Mean value thro row would be: 10/4 [ (1+2+3+4)/4
26/4 [ (5+6+7+8) /4...Like this i ve to do..
Please help me out
Hi,
See this attachment.....
Thanks and regards,
srikrishnaNF
Attachments:
Example_VI_BD.png 3 KB
Similar Messages
-
How to calculate acquisition value for specified day
Hi,
in my z program I have a problem how to calculate acquisition value for my asset for specified day.
Example:
I have asset created 8.7.2008 with TTYPE 104 (External asset acquisition) with value 5950.
30.11.2008 there is another TTYPE 272 (Retirement of current-yr acquis., w/o revenue) with value 950.
So BEFORE 30.11.2008 acquisition value is 5950. After is 5000. Is there any function module (or something else) in SAP system where I can send asset number and date a it return to me acquisition value for that day?
Many thanks for any answer!Hi,
your suggestion means that I have to compute acquisition value by myself (sum all TTYPE 1** - sum all TTYPE 2**). So SAP does't provide such functionality (LDB ADA have it, because it can compute acquisitiob value for specific day)?
Mant thanks for answer -
How to calculate difference and percentage in matrix report dynamic columns in SSRS 2008
Hi Friends,
I need to calculate Difference and Percentage In matrix report SSRS 2008
1) Row grouping based On Product
2) Column Grouping Week and Fiscal Year Current week and Previous Year same Weeks
3)Data Invnetory(Value fileld)
Example:
If value1 and Value2 Available we need to calculate Percentage and Difference.Otherwise Not required NA I need to Show.
For example If Particular week,Current year data is available,Previous year week data is not available No
need to cal Diff and Percentage we need to show Empty.
Below Code is working for If two values is available.
If any one of the fiscal year week data is not there it's taking some garbage values.
I tries with If condition in GetPCT() and GetDiff() It's not working.
Can some one please help me on this.
I am using the custom code
Public Shared Value1 as String
Public Shared Value2 as String
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as String,partner as String,Week as String) as String
If partner =previous and Week =previousweek Then
Value2=Value
Else
previous=partner
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
Public Shared Function GetPct()
return (Value2-Value1)/Value1
End Function
How to handle this.
Thank You, Manasa.VHi veerapaneni,
According to your description, if one of the fiscal year week doesn’t have data, the custom code returns false results.
For your requirement, if NULL value exists in the database, we should replace it as zero then perform calculate. So within the code, we should judge whether the value is NULL. To achieve your goal, please refer to the steps below:
1. Create a table like below.
create table dif4
([Product Group] varchar(50),
[Week] varchar(50),
[Fiscalyearweek] varchar(50),
value int
insert into dif4 values
('Desktops','W01','FY14W01',0),
('Desktops','W01','FY15W01',45),
('Desktops','W02','FY14W02',null),
('Desktops','W02','FY15W02',30),
('Desktops','W03','FY14W03',12),
('Desktops','W03','FY15W03',50),
('Notebooks','W01','FY14W01',35),
('Notebooks','W01','FY15W01',56),
('Notebooks','W02','FY14W02',45),
('Notebooks','W02','FY15W02',87),
('Notebooks','W03','FY14W03',75),
('Notebooks','W03','FY15W03',105),
('Tablets','W01','FY14W01',34),
('Tablets','W01','FY15W01',46),
('Tablets','W02','FY14W02',49),
('Tablets','W02','FY15W02',96),
('Tablets','W03','FY14W03',42),
('Tablets','W03','FY15W03',113)
2. Add the custom code in the Report Properties.
Public Shared Value1 as Integer
Public Shared Value2 as Integer
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
If Value=Nothing Then
Value=0
End If
If product =previous and Week =previousweek Then
Value2=Value
Else
previous=product
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetPct()
If Value1=0 Then
return 0
Else
return (Value2-Value1)/Value1
End If
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
3. Design the matrix like below.
4. Then get the expected results.<o:p></o:p>
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
How to calculate usage value through measuring document.
Hi,
While creating Sales Order with reference to a Contract i need to update the usgae value in the Order Quantity ( RV45A-KWMENG ) field (at line item level).
Can you help me calculate usage value through measuring documents for equipment over a period of time.
Is there any function module for the same?
Thanks.Hi,
To determine the usage value of a an equipment I had followed the following.
From table STPO, check if the material receipted belongs to a standard BOM (STLTY='S')
If yes, record the BOM (STLNR) and the BOM item node number (STLKN)
From PLMZ table, select the task list type (PLNTY), the key for task list group (PLNNR), the group counter (PLNAL), the task list node number for operation (PLNKN), if the record is not flagged for deletion (LOEZ)
From PLFH table, select the object type of the CIM resource (OBJTY), the object id of the resource (OBJID), the usage value (EWVGW) if the record is not flagged for deletion (LOEZ)
From CRVE_A table, select the equipment number (EQUNR)
The result of this selection will be all the tools which can be used for the production of the material receipted.
The measuring point for this or these equipment(s) will be selected from equipment number and EQUI table
The result of this selection will be all the measuring point to update.
Create new measurement document for the selected measurement point (transaction IK11)
Technically go as follows:-
MAT = material receipted
Select STLY, STLNR, STLKN from STPO table where IDNRK='MAT' and STLTY='S'
If results exist
Select STLTY, PLNNR, PLNAL, PLNKN from PLMZ where PLMZ.STLTY=STPO.STLTY and PLMZ.STLNR=STPO.STLNR and PLMZ.STLKN=STPO.STLKN
And PLMZ.LOEZ<>'X'
Select EWVGW, OBJTY, OBJID from PLFH twhere PLFH.STLTY=PLMZ.STLTY and PLFH.PLNNR=PLMZ.PLNNR and PLFH.PLNAL=PLMZ.PLNAL and PLFH.PLNKN=PLFH.PLNKN and PLFH.LOEKZ<>'X'
USAGE=PLFH.EWVGW
Select EQUNR from CRVE_A where CRVE_A.OBJTY=PLFH.OBJTY and CRVE_A.OJBID=PLFH.OBJID
All the equipment number selected at this moment will be called EQUIP in the next steps
EQUIP= Equipment number previously selected
Select OBJNR from EQUI where EQUNR=EQUIP
Select PARNR from IHPA where OBJNR=EQUI.OBJNR
If PARNR = Vend then
Select IMRC_POINT from equi where equnr=equip
All the measuring points selected at this moment will be called MEASP in the next steps
For each MEASP
Insert into IMRG the new increment value (USAGExMAT) in field CDIFF
Remark: the field CDIFF is managed in floating point number, accurate to 8 bytes.
I hope this is useful for you.
Regards,
Ankur Parab -
How to Set column value in SO matrix , if the column is not visible.
Hi,
We are trying to set value in to a column from sales order matrix with the below mentioned code
((SAPbouiCOM.EditText)oMat.Columns.Item("U_TWBS_AC_BaseEntry").Cells.Item(pVal.Row).Specific).String
it will throw an u201CForm Item is not editable u201C error if the column ("U_TWBS_AC_BaseEntry") visible is set to false through form settings.
how can we solve the issue,can we use any DI object in order to reset the form settings.
Thanks & RegardsHi
Try and make the column visible then set the value and make it invisible then
Hope this helps
Regards
Vivek -
Hi All,
I need to create a 5/5 matrix in SSRS report. The data will be :
Col_Side Col_Header Col_data
1 1 1
1 1 1
1 2 1
1 5 1
1 5 1
1 5 1
2 3 1
2 5 1
3 1 2
3 1 2
3 1 2
4 2 1
4 4 1
5 1 1
5 1 1
5 5 1
So, the matrix column will be Col_Header and matrix row will be Col_Side and count(Col_data) will be on the data.
Finally, it will create a 5 by 5 matrix with Count(Col_data) as its data for each combinations. If there is no combination (for ex: in the above data we do not have no combination of (1,3) , (1,4) , (2,1) etc..) then the matrix will be filling that corresponding
cell with zero.
Here I need to fill the cells with some colors based on some criteria.
I need to fill (5,3), (5,4), (5,5) combination with "Red" color. Like this , I need to give different colors in each of the cells. Here, (5,5) combination will be having 1 in its cell. (5,4) and (5,3) will be having zero in its corresponding
cells. I 'm trying to fill all the 3 cells with "Red" color. But, I am able to fill only (5,5) with "Red" color. Since the other 2 cells (5,3) and (5,4), has zero in their cells, it will not fill the cells with "Red" color.
How can I fill those two cells (5,3) and (5,4) with red color?
I know this is very vague. I have no option to give the picture here..
Please suggestHi Julie,
According to your description, there is a 5/5 matrix with three fields: Col_Side, Col_Header, Col_data. You drag Col_Side field to Rows, Col_Header to Columns and Col_data to Data, then filling blank cells with zero using expression. Now you want to fill
(5,3), (5,4), (5,5) cells with red color using expression, but it has no effect on cells (5,3) and (5,4).
According to my test, the expression has on effect on cells (5,3) and (5,4) since there is no corresponding data and the cells are blank. As a workaround, we can insert data for cells (5,3) and (5,4) in dataset, then use expression by following steps:
In the dataset, insert two sets of data (5,3,0), (5,4,0).
Right-click the cell of data, click Text Box Properties.
Click Fill in left pane, click (fx) button, then type the expression like below, then click OK.
=iif(Fields!Col_Side.Value=5 and Fields!Col_Header.Value >=3 ,"red","white" )
The following screenshot is for your reference:
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu -
How to calculate a percentage in a Matrix row SSRS
HI All,
I have the following data in a SSRS Matrix. I want the data to reflect as 'B' but I constantly get data reflected as a total.(C)
I need the percentage per row and not the whole total value.
this is my expression =count(Fields!Rejection_Reason.Value)/sum(Fields!ClaimCount.Value, "DataSet1")
A
Dealer
Total Sold
VW
Mercrcedez
Honda
Dealer1
10
2
5
3
Dealer2
20
5
10
5
Dealer3
30
10
5
15
B
Dealer
Total Sold
VW
Mercedez
Honda
Dealer1
10
20.00%
50.00%
30.00%
Dealer2
20
25.00%
50.00%
25.00%
Dealer3
30
33.33%
16.67%
50.00%
C
Dealer
Total Sold
VW
Mercedez
Honda
Dealer1
10
3.33%
8.33%
5.00%
Dealer2
20
8.33%
16.67%
8.33%
Dealer3
30
16.67%
8.33%
25.00%
60
Thank you for your help.Hi Andrevw23,
Just as michlimes suggested, we should sum the value of ClaimCount field in the Dealer group region, other than the dataset. Because the sum function sum all non-null numeric values in the specified scope. So in your scenario, we can try to use the function
below to achieve your requirement (“Dealer” means the name of Dealer group):
=count(Fields!Rejection_Reason.Value)/sum(Fields!ClaimCount.Value, "Dealer")
If you have any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
How to change the value in a matrix...
Hi,
I want to update the price field in the Sales Order matrix. This I want to do as soon as the user selects the Item from the choose window. I trapped the ItemEvent of the SAPSBOUIApplication. But after getting the control of the matrix I am unable to see or edit the value in it. Please guide me how to do it? More better it would be if any one can explain me with one sample on how to insert our own logic in the existing flow of any transaction and modify values as per our new logics.
Thanx in advance.
With Regards,
Ram.Hi Ram Bilas Yadav
You want an example, an example you will get, try the following, it will work on a AR invoice, once you have selected a value in the choose from list for itemcode it will then assign a value in the price column.
If pVal.FormType = "133" Then 'And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then
If pVal.ColUID = 1 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And pVal.BeforeAction = False Then
Try
Dim omatrix As SAPbouiCOM.Matrix
Dim oColumn As SAPbouiCOM.Column
Dim oColumns As SAPbouiCOM.Columns
omatrix = SBO_Application.Forms.Item(FormUID).Items.Item("38").Specific
oColumns = omatrix.Columns
Dim oEdit As SAPbouiCOM.EditText
oEdit = oColumns.Item("17").Cells.Item(pVal.Row).Specific
oEdit.Value = 12
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End If
Hope this helps -
How to calculate avg value in bex
Hi all
I have a requirement
I want to run a query for a particular period say 0032005.
in the query output value will display for all prior period in different column. for perod 003
it will display value for 001 , 002 ,003. and
at the last column i want calculate the avarage for this 3 period. these should be dinamic.
if i run this query for period 0052005. query will display value for period 001 ,002 ,003,004,005 and last column will display avarage for the 5 period.
i am able to diaplay each prior period in different column that is fine. but i am not abel to calculate the avarage column.
example
selection screen :
fiscal period : 0042005
Query output
Char 0012005 0022005 0032005 0042005 Avg
88 99 77 66 (889977+66)/004
Please any one know about please help with steps.
ThanksI have a requirement
I want to run a query for a particular period say 0032005.
in the query output value will display for all prior period in different column. for perod 003
it will display value for 001 , 002 ,003. and
at the last column i want calculate the avarage for this 3 period. these should be dinamic.
if i run this query for period 0052005. query will display value for period 001 ,002 ,003,004,005 and last column will display avarage for the 5 period.
i am able to diaplay each prior period in different column that is fine. but i am not abel to calculate the avarage column.
example
selection screen :
fiscal period : 0042005
Query output
Char 0012005 0022005 0032005 0042005 Avg
88 99 77 66 (889977+66)/004
I got the resolution as bellow.
In the Characteristic Property Set it as Suppress Result Rows-> Never. For the key figure Set Calculate Result Rows-> Average of All Values.
yes it is working fine . but there is a small problem in the column heading for this colume is displying as overall result. but values are displying as a avg value. how can i change it.
why i ahve to create a text variable. please explain -
How to calculate query value on extended range of data
Hi,
This is my first post, so let me greet all forum users. I'm reading the forum for few weeks and I'm really impressed with the force of this community.
My question is based on some real problems but I'll ask in general:
In a BEx query - is it possible (and how?) in a result cell to obtain value that is calculated based on some more extended range of infoprovider records than it results from all the characteristics related to that cell?
The question is somehow about a reverse case to the restriction in Selection. I'm asking about a kind of 'extension' of selection.
Example for the question follows (it is somehow simple, I put it here just to picture the problem, note: the question is more general!)
cube: ch: 0CALMONTH, 0MATERIAL, 0PLANT
kf: 0QUANTITY (ex. of outgoing deliveries)
What I need is to obtain in any query the SUM(0QUANTITY) over all 0PLANT (this can lead to knowing the 'activity' of the specific plant by calculating the share. that activity can be calculated at diferent level of detail).
The 'dream' query would look like:
rows: 0CALMONTH, 0MATERIAL, 0PLANT
cols: 0QUANTITY SUM_OVER_0PLANT
resulting in ex:
0CALMONTH 0MATERIAL 0PLANT 0QUANTITY SUM_OVER_0PLANT PLANT_ACTIVITY
2005.01 00001 P100 10 30 1/3
2005.01 00001 P200 20 30 2/3
2005.01 00002 P100 30 70 3/7
2005.01 00002 P200 40 70 4/7
2005.02 00001 P100 50 110 5/11
2005.02 00001 P200 60 110 6/11
2005.02 00002 P100 70 150 7/15
2005.02 00002 P200 80 150 8/15
after removing drill 0MATERIAL:
0CALMONTH 0PLANT 0QUANTITY SUM_OVER_0PLANT PLANT_ACTIVITY
2005.01 P100 40 100 4/10
2005.01 P200 60 100 6/10
2005.02 P100 120 260 12/26
2005.02 P200 140 260 14/26
after removing drill 0CALMONTH:
0PLANT 0QUANTITY SUM_OVER_0PLANT PLANT_ACTIVITY
P100 160 360 16/36
P200 200 360 20/36
For this specific case I investigated several solutions:
1) using formula & function SUMCT (Result). This has a drawback that Result for 0PLANT must be present in right place (bottom level) in the resulting query. I don't like this.
2) SUM can be directly precalculated in the cube. Well, I'd prefer Bex only...
Please keep in mind also following:
1) there may be a need to refer to the data that is outside prompt/filtering/restricting range.
2) I want to preserve all the OLAP freedom, so all the solution should be a query with some tricky formula/kf/??? to be used by user in any situation and producing right result.
I hope I'm not demanding to much...
(now after this long example please have a look at the question again!)
Regards,
MirekHi Ashwin,
while using SUMCT I loose the freedom of OLAP. SUMCT calculates properly SUM_OVER_0PLANT only when the 0PLANT is the lowest drillin level. If this is not the case (ie. some other ch is the lowest level or 0PLANT results are suppressed) the approach won't provide right result.
sure I will reward all helpfull posts.
regards,
Mirek -
Hi Experts,
I have doubt, i have an internal table now i want to calculate the total for every group. How to do that?
value type
5,439.01 ; ZMP0
509.60 ; ZMP0
4,749.26 ; ZMP0
9,053.95- ZPNL
732.70- ZPNL
66.30- ZPNL
18.10- ZS03
63.90 ; ZS03
According to the type i need a total for ZMPO, ZPNL, ZSO3 separately.
how to do that?
5,439.01 ; ZMP0
509.60 ; ZMP0
4,749.26 ; ZMP0
ZMPO total =
9,053.95- ZPNL
732.70- ZPNL
66.30- ZPNL
ZPNL total =
18.10- ZS03
63.90 ; ZS03
ZSO3 total =
Like that i need, can any one help this?
Regards,
MohanaHello,
Use the COLLECT.
DATA:
wa LIKE LINE OF itab,
itab_sum LIKE itab.
SORT itab BY key.
LOOP AT itab INTO wa.
COLLECT wa INTO itab_sum.
ENDLOOP.
The itab_sum has the same structure like the itab where is the data to me summarized, and the wa has the line structure of the itab.
Regards. -
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? -
How to calculate some value that referring to another table
Hi...
Need help asap
The questions are :
Q1 : In Microsoft Excell, we can take value from one cell and use it to another cell.
How about in BO, if we want to take value (ex. 93.75) from the other table and use or refer the value that we want to to another table (just use the value from another table)
Just for information, we want to use the number (93.75) in another function. (if <93.75, then........) and the value (93.75) is a result from another function or calculation.
Q2 : How to SUM from one table and show the result to another table.(We want to use the result of SUM for another calculation in different table.)
Thanks for your kind help.Eva,
In answer to your question about using a cell from report (block) as a value to be manipulated within another block, will be tricky unless you can employ the "Merge Dimensions" technique. Working in the blind and trying to visualize what you are trying to do is very difficult, so to speak in general terms, you will have to determine a best way to merge dimensions, then build specific local variables to "flag" and extract succinct values from one data provider, and then use that local variable in applying it to the other block. This will take some experimentation and testing before you can feel confident and get the hang of it.
On the other hand, if you know what the threshold value is that you want to apply (like for instance 91.75), then you can either "hardcode" that in your formula(s), or build a prompt in your report that captures this tidbit from the user when the report runs, and using the UserResponse function you should be able to calculate what it is you want to do.
Good luck and post more details (specific tables, columns, and manipulations) and perhaps some one can post a suggestion on how to best execute your report.
Thanks,
John -
How to Calculate Line items Total of Matrix Column
hai experts,
Im facing a problem like
1. i have a matrix with a column Labour Costs in that im taking some cost.
2. in footer a have a Edit Text like Total Labour Cost
3 when i enter amount in matrix column it sholud disply that value in total labour cost and when we add new row ,labour cost it should add to 'total labour cost' in footer.Like Invoice Documents.Where do you want to implement this like sapscript / smartforms or adobe forms? please specify.
-
How to calculate a value in sap script?
Hi friends i have to do addition and then display the added value in grandtotal like
total amount + late fee = grand total
i have to do this in sap script can anyone tell me the procedure where to declare wheather in abap aditor if yes how?Hi ...
Its easy to add up two values...
u can do it in a subpool program...
Refer the following code:
Code the following in the Script...
/: PERFORM TOTAL_SUM IN PROGRAM 'ZTEST_ADDITION'
/: USING &VAL1&
/: USING &VAL2&
/: CHANGING &TOTAL&
In the EDitor..create a program ' ZTEST_ADDITION'..
FORM TOTAL_SUM TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
Read in_tab index 1.
Here u will get the val1...
Read in_tab index 2.
here u will get val2.
l_v_total = val1 + val2.
read out_tab index 1.
out_tab-value = l_v_total.
modify out_tab index 1.
Write the changing paramets in the form
to Output the values...
Thanx,
navin..!
Maybe you are looking for
-
How do I deauthorize iTunes on a dead PC?
Hi, My old Gateway recently crashed. I was able to move my iTunes library to a new PC, but when I try to authorize the new computer it tells me that I am at my max of 5. Is there any way to manage the de-authorization process from a new PC? I am fine
-
Premiere Pro CC Source and Program Playback Controls not working.. help please.
Hi, Need your help to find out why none of the Premiere Pro CC Source and Program Playback Controls are working.. I can do playback using spacebar, but not clicking on the controls... same goes the rest. Thank you, Mauro
-
Help! Fonts unreadable the Symbol A in a box!
All of the characters for fonts for icons are now the letter "A" in a box. All drop down menus as well! I'm suspecting this has something to do with a software update I was NOT supposed to do... I have a Mac Mini non-Intel.
-
Mapviewer-demo: no map viewed
Hi, I imported the Mapviewer demo in a new schema, and deployed the Mapviewer on stand alone OC4J. I can start and configure the Mapviewer how described in the guide without errors but when i try to submit a map request using the sample file included
-
Problem to Install Oraclce 11g on Linux
HI I am Try to Install Oracle 11g on Enterprise linux 4. But The Following Problem Come. How can I configured to display at least 256 colors? How can I resolve it. Checking Temp space: must be greater than 80 MB. Actual 14041 MB Passed Checking swap