Calculate sum of under estimates
I have a 2008 r2 cube with 2 measures EstmatedTime and ActualTime and a date dimension. I need to calculate the sum of the under estimates. So if my estimated hours on the 1st, 2nd and 3rd are 10, 10, 10 and my actual hours are 11, 12,
7, I need to return 3 as the sum of the under estimates for the period. Is there a way to do this using MDX, or do I need to do it in the ETL?
John Schroeder
Hi JS,
Considering both the measures are at same granularity, try the below:
Create a calculated member :
with member [Measures].[Diff] as
iif(isempty([Measures].[EstmatedTime])=TRUE and isempty([Measures].[ActualTime]=TRUE,null,
iif([Measures].[ActualTime] > [Measures].[EstmatedTime],[Measures].[ActualTime] - [Measures].[EstmatedTime],0))
Now the result would be fine at Date level, but at a higher level say Month the result would not as expected, as the calculated member [Measures].[Diff] would be calculated after aggregating EstmatedTime and ActualTime at month level. In order to fix this
define a scope.
Scope( [DimDate].[DateHierarchy].[Month],[Measures].[Diff]);
This = Sum( Descendants( [DimDate].[DateHierarchy].CurrentMember,[DimDate].[DateHierarchy].[Date]),[Measures].[Diff]);
End Scope;
Similarly define scope for all higher datehierarchy levels.
Saurabh Kamath
Similar Messages
-
How to calculate sum in jtable
Hi,i want to ask.Can you teach me how to calculate sum in jtable?For example i got rows of qty,price and total.The total is null unless the user enter value in qty,and when the user press enter key in the qty,the sum will be displayed in the total.Thanks a lot..
Calculate the sum on the fly when the tableModel is updated (setValueAt() ) or let your row Object deal with it.
-
How to calculate sum of the fields in adobeforms
Hello Experts
can i know how to calculate sum of fields in the adobe form. I have few fields to be summed in total field.
RegardsHello Surendra,
Suppose you are having 4 fields and the 4th field is the TOTAL field.
Write the below Javascript on the Initialize event of TOTAL field as shown below.
Remember that if you use just "+" sign without Number() or ParseInt() function it acts like String Concatenation.
this.rawvalue = Number( this.parent.field1.rawvalue ) +
Number( this.parent.field2.rawvalue ) +
Number( this.parent.field3.rawvalue ) ;
You can also write is as shown below.
this.rawvalue = parseInt( this.parent.field1.rawvalue ) +
parseInt( this.parent.field2.rawvalue ) +
parseInt( this.parent.field3.rawvalue ) ; -
How to calculate SUM from multiple numbers in one cell
Is it possible to calculate SUM if I want to put multiple numbers in one cell?
Many thanks in advanceyou can sum cell by using the sum() function.
you can sum a row:
=sum(1:1)
will sum ALL cells in row 1
you can sum a column:
=sum(C)
will sum all cells in column C
you can sum a list of cells:
=sum(A1, C5, E76, B1:5)
will add together cells A1, C5, E76, B1, B2, B3, B4, and B5 -
How to calculate sum of quantities of same item in po release using form personalization?
I am doing one form personalization in which an item can be entered multiple times in with different released quantity and need by date.
I want to calculate the sum of release quantity of items.
How I can achieve this using form personalization?
Thanks
SunnyHi Gayatri,
I'm not too sure why this isn't working as the logic seems correct.
Here's another way to do this:
1) Create another formula and place this on the Details Section:
whileprintingrecords;
numbervar x;
if onfirstrecord then
x := {Field_to_summarize}
else if {ExcisePur.ItemCode} <> Previous({ExcisePur.ItemCode}) And {ExcisePur.Batchnum} <> Previous({ExcisePur.Batchnum}) then
x := x + {Field_to_summarize};
2) Create another formula and place this on the Report Footer:
whileprintingrecords;
numbervar x;
-Abhilash -
Javascript auto calculate sum in form
Hello all,
I have a question for you, probably pretty simple but I don't know JavaScript well enough. What I have is four TextFields in a form. I want the value of the first two (let's call them A and B) to multiply and autopopulate the total in the fourth TextField (D). In the third TextField (C) I want the number entered to be multiplied by 3.25 and be added to the total in the 4th TextField. In other words A*B+(C*3.25)=D
In plain English, this is for a community garden registration. Number of plots times Fee per plot (which varies based on income level) plus optional bales of hay at $3.25 = _____________.
Any JavaScript experts out there who can help me?
Thanks much!
DaveThanks, Gramps, but not exactly what I was looking for. What I have is 4 TextFields, no radio buttons, etc. I want the first two to multipy, and the third I want to calculate the number typed in times 3.25 adding the sum of the three to the fourth box. I've come close to finding some JavaScript online, but can't quite figure out the exact JavaScript coding to do this. I have a feeling it is simple, just that I know next to nothing about JavaScript and was hoping to find a quick solution until I do have the chance to learn more. Anyone?
-
How to calculate sum of the fields that will be reflected for every row entry??
Probably, the title might not give you the correct view on the question that I want to ask but, I can describe my question. Well, I have an
Excel sheet for attendance where in I have different columns
for 3 subjects (subject1, subject2, subject3) and a
total column. I also have another column named as Student ID.
I would like to write a formula for the total column where, when I enter the number of classes attended in every subject column for each student present in every row, then the total column is reflected with the sum of no.of classes attended in every subject
for each student automatically.
How can I achieve this? I am looking forward for any help. I am a beginner.
Ex: Excel sheet
Student ID | Subject1 | Subject2 | Subject3 | Total
1
| 2
| 3
| 4 |
9
2 | 3
| 5
| 2
| 1
The total column should be reflected with the sum of values under subject1, subject2, subject3 fields automatically for every row. How to do it?
Thank you,
Kaushik.In the first empty cell of the row of Student 1, enter a formula like
=SUM(B2:D2)
where column B is headed Subject 1 and column D is headed Subject 3, then copy down to match your student list.
Then below the last row of column B, enter the formula
=SUM(B2:BXXX)
where 2 is the row of Student 1, and XXX is the row number of the row above the formula, then copy across to match. -
How to Calculate Sum of Difference between two dates
Hi,
I'm using BI Publisher in Siebel CRM.
In RTF template I have the following expression to calculate the Difference between dates
<?xdoxslt:date_diff( 'd' , psfn:totext(CIRGSubmittedDate,"yyyy-MM-dd","MM/dd/yyyy"), psfn:totext(Done,"yyyy-MM-dd","MM/dd/yyyy"), $_XDOLOCALE, $_XDOTIMEZONE)?>
The above expression works for me to calculate the dates.
I need to calculate the Sum of all these dates for a Group.
Want to know the Syntax for Sum function using Date_diff.
Tried the following and didn't work.
<?Sum(xdoxslt:date_diff( 'd' , psfn:totext(CIRGSubmittedDate,"yyyy-MM-dd","MM/dd/yyyy"), psfn:totext(Done,"yyyy-aMM-dd","MM/dd/yyyy"), $_XDOLOCALE, $_XDOTIMEZONE))?>
Not sure what I'm doing wrong here...
Anyone please help...
Thanks
PVHi
To break the diff between 2 dates into days, hours, minutes, sec -- you can use the following:
select to_char( created, 'dd-mon-yyyy hh24:mi:ss' ),
trunc( sysdate-created ) "Dy",
trunc( mod( (sysdate-created)*24, 24 ) ) "Hr",
trunc( mod( (sysdate-created)*24*60, 60 ) ) "Mi",
trunc( mod( (sysdate-created)*24*60*60, 60 ) ) "Sec",
to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' ),
sysdate-created "Tdy",
(sysdate-created)*24 "Thr",
(sysdate-created)*24*60 "Tmi",
(sysdate-created)*24*60*60 "Tsec"
from all_users
where rownum < 50
HTH
RangaReddy -
Require a function module to calculate sum of the quantity based on GRNDATE
hi friends,
I need to calculate the sum of the quantity based on GRN DATE and invoice date.
the invoice date given in select-options should be captured by program and from the previous day it need to retrieve the GRN dates and corresponding quantities and i need to do the summation of all these quantities can anybody tell any function module.
Thanks in advance.Try function MD_CONVERT_MATERIAL_UNIT
the table of UOM's is MARM.
Doug -
Calculate sum of long integer!
Hi!
Im new to java and just started to learn but have a little problem. What I want to know is how I can get a long integer from the user and then caculate the sum of the separate numbers? I thinking I would use som sort of array and then calculate from there. The thing is Im use to ada programminglanguage so I understand the problem but dont really know how to tackle the problem in java.
So if someone could help I would be grateful!
//ViktorJulingo wrote:
"I guess you have a handle on how to get an integer from the user then? Can you write the code to get an integer from the user and display it? And "long" and "int" are two different things - which one are you talking about, a 32 bit number or a 64 bit number?"
Yes, I do know how to get an integer from a user and display it. So far so good :) If I wasnt that clear it is a "long" 64 bit Im trying to get from user and then caculate the sum like this:
enter integer: 1234567
digits are 1 2 3 4 5 6 7 and the sum is 28
/ViktorOk, so, you know how to get input from the user and display it - so - look at the API for the String class and think about your "I think I'll use an array" idea and see what you find there
Edited by: tsith on Sep 9, 2008 7:49 PM -
Calculate SUM based in condition in iTAB
Hi all,
I have the ITAB as follows.
wa_mseg-mblnr = '5000000130'.
wa_mseg-mjahr = '2008'.
wa_mseg-bwart = '901'.
wa_mseg-dmbtr = '00000005000'.
wa_mseg-bpmng = '00000000100'.
wa_mseg-ebeln = '1059200855'.
wa_mseg-ebelp = '00010'.
APPEND wa_mseg to itab_mseg.
wa_mseg-mblnr = '5000000131'.
wa_mseg-mjahr = '2008'.
wa_mseg-bwart = '902'.
wa_mseg-dmbtr = '00000002500'.
wa_mseg-bpmng = '00000000050'.
wa_mseg-ebeln = '1059200855'.
wa_mseg-ebelp = '00010'.
APPEND wa_mseg to itab_mseg.
wa_mseg-mblnr = '5000000132'.
wa_mseg-mjahr = '2008'.
wa_mseg-bwart = '901'.
wa_mseg-dmbtr = '00000002500'.
wa_mseg-bpmng = '00000000050'.
wa_mseg-ebeln = '1059200855'.
wa_mseg-ebelp = '00010'.
APPEND wa_mseg to itab_mseg.
now i want to add the BPMNG for the BWART = 901
DMBTR for the BWART = 901
ans same thing for the BWART = 902.
how do i calculate the SUM based on condition.now i want to add the BPMNG for the BWART = 901
DMBTR for the BWART = 901
ans same thing for the BWART = 902.
how do i calculate the SUM based on condition.
Hi, you can loop de internal table and do a control cut by "bwart". For doing that the order of the fields of your internal table must change.
If you have:
1st.mblnr
2nd.mjahr
3rd.bwart
you have to change to:
1st.bwart
2nd.mblnr
3rd.mjahr
So in the loop you will can do like this.
loop at itab.
aux_sum = itab-BPMNG + aux_sum.
at end of bwart.
* Here you will have de SUM for BWART.
* Then you clear aux_sum for the next different BWART.
endat.
endloop.
hope this help you.
Andrew83 -
Hi Everyone
I used this in SP calculated column field.
=IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))
it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
Thanks,
NormanHi Everyone
I used this in SP calculated column field.
=IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))
it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
Thanks,
Norman -
How to use decode to calculate sum for different date range
I'm stuck with decode() function:
I have a table like this:
(project_id, approve_date, value, builder_code)
I want to write a SQL query to get sum of values for different month of the approve_date, and group by builder_code)
The result is like this:
builder_code Sum(value)_Sep-03 Sum(value)_Oct-03 Sum(value)_Nov03
1001 1,299 1,322 990
1002 3,332 1,222 333
I tried to use decode for this question but could not get the answer.
Thanks a lotI don't think you need a DECODE() here. I'd do something like this-
create table builder (
project_id number,
approve_date date,
value number,
builder_code number
insert into builder values( 1, to_date('09-01-2003', 'MM-DD-YYYY'), 100, 990 )
insert into builder values( 2, to_date('09-03-2003', 'MM-DD-YYYY'), 150, 990 )
insert into builder values( 3, to_date('09-05-2003', 'MM-DD-YYYY'), 250, 990 )
insert into builder values( 3, to_date('09-05-2003', 'MM-DD-YYYY'), 250, 333)
SELECT sept.builder_code, sept.sept_sum, oct.oct_sum
FROM (SELECT builder_code, sum(value) sept_sum
FROM builder
WHERE approve_date >= to_date('09-01-2003','MM-DD-YYYY')
AND approve_date < to_date('10-01-2003','MM-DD-YYYY')
GROUP BY builder_code) sept,
(SELECT builder_code, sum(value) oct_sum
FROM builder
WHERE approve_date >= to_date('10-01-2003','MM-DD-YYYY')
AND approve_date < to_date('11-01-2003','MM-DD-YYYY')
GROUP BY builder_code) oct
WHERE oct.builder_code(+) = sept.builder_code
BUILDER_CODE SEPT_SUM OCT_SUM
333 250
990 500Justin
Distributed Database Consulting, Inc.
www.ddbcinc.com/askDDBC -
How to Calculate sum for the selected rows in ALV gird using custom button
Hi I am trying to implement an ALV Grid display where the user can select few rows in the output and if he click on some custom button he should get the sum for only those rows.
Can anyone give me some idea regarding this.
Thanks in advanceWhile building the fieldcatalog for amount field use gt_fieldcat-do_sum = 'X'. And use the below for doc type sorting and subtotal.
* ALV data declarations
data: it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
perform build_sortcat.
*& Form build_sortcat
* Build Sort catalog
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
wa_sort-SUBTOT = 'X'. "subtotals any totals column by this field
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'.
* gd_sortcat-tabname
APPEND wa_sort TO it_sortcat.
ENDFORM. " build_sortcat
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
Regards,
Chandru -
How to calculate Sum of records that are not Suppressed
Hi All Experts,
I have Created A layout for SAP B1 in crystal report.Because of Some Condition I have to Suppress Detail Section.
The Suppress Condition is As Follows
{ExcisePur.ItemCode}=Previous({ExcisePur.ItemCode}) And {ExcisePur.Batchnum}=Previous({ExcisePur.Batchnum})
And it is Working Fine,the Desired Detail Section is Suppressed.
Now I Have to take Sum of Records ,But that records are also Calculated which are Suppressed.
For these I have Read Several post where someone had same problem,
there they have Asked to Create A Running Total And use the Formula in evaluate section same as in Suppress Condition but opposite of it.
I did the same thing using these Formula
{ExcisePur.ItemCode}<>Previous({ExcisePur.ItemCode}) And {ExcisePur.Batchnum}<>Previous({ExcisePur.Batchnum})
But it is Calculating only the Suppressed Record But Not the Record which is to be Calculated.
Please help me to Accomplish this.
I am very Much blank where I am going wrong.
Regards,
Gayatri ShuklaHi Gayatri,
I'm not too sure why this isn't working as the logic seems correct.
Here's another way to do this:
1) Create another formula and place this on the Details Section:
whileprintingrecords;
numbervar x;
if onfirstrecord then
x := {Field_to_summarize}
else if {ExcisePur.ItemCode} <> Previous({ExcisePur.ItemCode}) And {ExcisePur.Batchnum} <> Previous({ExcisePur.Batchnum}) then
x := x + {Field_to_summarize};
2) Create another formula and place this on the Report Footer:
whileprintingrecords;
numbervar x;
-Abhilash
Maybe you are looking for
-
Solman EHP1 upgrade Stack 20 - cannot log in to system
Hi all, I am currently doing a patch of Stack 20 for solman EHP1. I was able to create the queue, was able to continue until import proper phase 2. After a while, i cannot log on the system. CX_WB_ED_SYNTAX_ERROR is unknown. abap program SAPMSYST ha
-
How to run Windows on top of Linux
Just an idea for those of you who are using Linux but still need to run Windows XP or Vista for one reason or another. When I bought my machine, I immediately reformatted the HD getting rid of Vista and all of that other prebundeled junk that made my
-
Use 15 in. Retina Display with iPad
Is it possible to use an iPad as a second monitor with a 15 inch MacBook Pro with retina display?
-
What version of Flash Player in 10.4.7 update
I know Safari gets updated to version 2.0.4. Does Flash Player get updated??
-
What are the features of Oracle Database Cloning
What are the features of Oracle Database Cloning