Query: Making pct. calculations on cumulated rows.
Hi Experts
I have a problem in a query. See the query below. The problem is that column 8 shows the same result as column 7 What I find strange is that column 6 is just right - it shows the YTD-deviation, which I would like to show in pct in culumn 8.
Does anybody know how I can make the %Dev on the YTD numbers in column 8?
Rows:
- Calendar month2 (monthnumbers: "1", "2"..."12")
Columns (Units sold):
1. Actual Month: current calendar year, billed quantity
2. Actual Month LY:current calendar year -1, billed quantity
3. Actual Year To Date: current calendar year, billed quantity (cumulated)
4. Actual Year To Date LY: current calendar year -1, billed quantity (cumulated)
5. Dev Month: Actual Month - Actual Month LY
6. Dev Year To Date: Actual Year To Date - Actual Year To Date LY<b>(OK)</b>
7. %Dev Month: Actual Month % Actual Month LY
8. %Dev Year To Date: Actual Year To Date % Actual Year To Date LY<b>(NOT OK)</b>
Kind regards and thanks in advance,
Torben
Torben,
The cumulation for the KF is done only in the front end and hence the cumulated value is not available to the OLAp processor and hence you cannot use the cumulated value in another formula.
This basically means that even if you use a cumulated figure in another formula you will still get the calculation on the basic value..
for example :
char|Basic Value|CUmulated Value|Cumulated value *2
A|1|1|2
A|2|3|4
A|3|6|6
If you notice row two it is taking the base value into 2 and not the cumulated value..
The only option for the same is to use a macro if the query is in excel or use the table modifier to change the displayed value..
Arun
Hope it helps...
Similar Messages
-
Report with characteristic and calculation in the rows
Hi,
I need to do a report that has to have in the rows a characteristic, a selection and calculation based in the result line of the characteristic, as presented following:
Column X Column Y ...
Characteristic
Result line
Selection (hided)
Calculation (Selection / Result line *100)
Then its necessary to be possible to drill down to another characteristic.
Please if you have done some report like this one please give me some ideas on how to do it.
I'm thinking to make a workbook with two queries but this arise some issues in terms of the layout because I would need to put the query with the calculation above the other because otherwise it would be overwrote.
I have some doubts also on how to make the drilldown possible???
If you can help me I would be very grateful and I will assign points...
Best regards,
AnaHi Ane,
It seems little tricky here.
Try this way to see all your values of Asset class in single selection(Hope it works!!)
Rows -> First Drag Asset Class
Then create a structure jsut below this Char -> In New selection,define the name as you want & Use Asset Class as Restriction
It should look like this in rows:
Asset Class (Char)
Structure
Asset Class (Name of your selection - restricted with Asset class)
Please check n lemme know if it works
Sriman -
Problem with the query of Sharepoint Calculated Fields
Hello,
I am developing an application in sharepoint 2013 foundation. but i have problems with a list, when executing a caml query on a calculated field. I try the solution of this blog
http://sptalks.wordpress.com/2013/03/25/query-on-calculated-field-problem
but i got no result
attentive to any comments
thanksHello,
This is my CAML Query
<View>
<ViewFields>
<FieldRef Name="ID" />
<FieldRef Name="PermMask" />
<FieldRef Name="FSObjType" />
<FieldRef Name="Nombre" AutoHyperLink="TRUE" />
<FieldRef Name="Apellidos" AutoHyperLink="TRUE" />
<FieldRef Name="Cargo" /><FieldRef Name="Edad" />
<FieldRef Name="Compa_x00f1_ia" />
<FieldRef Name="Created" />
</ViewFields>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Compa_x00f1_ia" />
<FieldRef Name="Edad" />
</GroupBy>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
<Where>
<Contains>
<FieldRef Name="Ano" LookupId="FALSE" />
<Value Type="Text">2014</Value>
</Contains>
</Where>
</Query>
</View> -
Hi
Question:
In a hierarchical query, is it possible for a row to have more than one immediate ancestor?
Answer:
No
No? Surely, it's yes?
Thanks,
JasonAs Frank pointed out already hierarhical most often means a tree (data structure) to deal with.
There must usually be just one boss (the root) in which case the answer is no.
Something to read: http://en.wikipedia.org/wiki/Tree_(data_structure)
You can find out Solomon spoke about a generalization therein.
Related to forum troubles:
If I login first thing after reaching forum, the behaviour is rather consistent - I'm allowed to post answers, otherwise ...
Regards
Etbin -
Percentage Calculation for result rows
Hi
I have problem with percentage calculation on result rows. I have 2 KFs A and B, the result is calulated by setting 'calculate result rows as' to 'summation'.
But in KF 'C' (which is calculated as A/B*100 ),
Now the probles is the systen picks up original values of A and B for calculation of C in result rows.
i.e. system picks up values of result rows for A and B for
setting 'calculate result rows as' to 'nothing defined'.
Any ideas on how to fix this.
Thanks
KarenKaren
I found something in Forum for you
Result Rows Calculation
Pradip's Solution should work. Try and if it is don't forget to award points.
Regs
Gopi -
Inner Query relating to calculated field in main query
I have a query that has calculating fields in it.
What I am trying to do is Create another inner SELECT query similar to the one above but using the FP_Qty_Required calculated field in the main query?
Is this even possible?
Thanks in advance
AaronSorry. I did that because it looked a mess when I pasted it in.
SELECT P.ItemNumber, P.DeliveryWeek, D.StartDate AS WC_Date, S.SumOfSchedule_Qty, P.Planned_Production_Qty, P.Actual_Production_Qty, D.StartDate,
CASE WHEN S.SumofPartPallet < 0 THEN 'PART PALLET' ELSE '' END AS PartPallet, S.FirstOfIntouchRef, S.Pallet_Qty,
S.FirstOfTool_Number,
CAST(CASE WHEN S.SumOfSchedule_Qty > 0 THEN (S.SumOfSchedule_Qty - 1.0) / S.Pallet_Qty ELSE 0.00 END AS DECIMAL(18,
2)) AS DecNoOfPallets,
CEILING(CAST(CASE WHEN S.SumOfSchedule_Qty > 0 THEN (S.SumOfSchedule_Qty - 1.0) / S.Pallet_Qty ELSE 0.00 END
AS DECIMAL(18, 2))) AS QtyOfFullPallets,
CASE WHEN s.sumofpartpallet < 0 THEN s.sumofschedule_qty ELSE CEILING(CAST(CASE WHEN S.SumOfSchedule_Qty >
0 THEN (S.SumOfSchedule_Qty - 1.0)
/ S.Pallet_Qty ELSE 0.00 END AS DECIMAL(18, 2))) * s.pallet_qty END AS FP_Qty_Required,
(SELECT SUM(SumOfSchedule_Qty) AS Expr1
FROM dbo.SumOfSchedDelivery
AS s2
WHERE (ItemNumber = S.ItemNumber)
AND (DeliveryWeek <= S.DeliveryWeek)) AS Running_Sum,
FROM dbo.Production AS P INNER JOIN
dbo.SumOfSchedDelivery AS S ON P.ItemNumber = S.ItemNumber AND P.DeliveryWeek = S.DeliveryWeek INNER JOIN
barcoding.dbo.DeliveryWeeks AS D ON P.DeliveryWeek = D.DeliveryWeek INNER JOIN
dbo.TotalRequiredByItem AS T ON S.ItemNumber = T.ItemNumber
The above works. What I want to do next is after the Running_Sum to add another sub query similar to this:
(SELECT SUM(FP_Qty_Required) AS Expr2
FROM ???
WHERE (PD.ItemNumber = ItemNumber)
AND (PD.DeliveryWeek >= DeliveryWeek)) AS Running_FullPallet
FP_Qty_Required is a calculated field in the main query. -
Apply cumulative row value captured within transaction (for DWH incremental update)?
Dear community,
Don't know how to properly name it (applying cumulative row value, or merged row value, or something else) but consider the following scenario for Oracle to Oracle replication.
I have a table on the source system
create table tab(
id number( 14, 0 ) not null
, f1 varchar2( 30 char )
, f2 varchar2( 30 char )
, constraint pk_tab primary key ( id )
Having following DMLs within the first transaction
insert into tab( id, f1, f2 ) values ( 1, 'Hello', 'Dolly' );
update table tab
set f1 = 'Bye'
where id = 1;
update table tab
set f2 = 'Mary'
where id = 1;
and following ones within the second
update table tab
set f2 = 'Mary'
where id = 1;
delete tab
where id = 1;
can I make GoldenGate to apply the following to the target table
insert into tab( id, f1, f2 ) values ( 1, 'Bye', 'Mary' ); -- for the first transaction (source mode replication )
delete tab where id = 1; -- for the second one (source mode replication)
or just to do nothing in normal mode (capturing changes across the 1rst and the 2nd transaction and merging insert with delete into NOOP)?
Our team considers using GoldenGate to apply incremental data changes to DWH and definitely there is no need for applying intermediate values.
As far as I understand using BATCHSQL wont help in that case, cause it will only organize 2 updates withing 1rst transaction into one batch operation. Am I right?
Regards, Anton.Hi,
How do I interpret it ...That's a mighty big question. The STATSPACK report is very complex. I have my notes here, on how I do it:
http://www.dba-oracle.com/t_reading_statspack_report.htm
And can anyone please suggest measures The way your report is posted, it's very difficult to read!
I wrote a free tool that will accept your STATYSPACK report and make rudimentary suggestions, you might want to give it a try:
http://www.statspackanalyzer.com
Hope this helps. . .
Donald K. Burleson
Oracle Press author
Author of "Oracle Tuning: The Definitive Reference": -
Query for MAP Calculation - Price Control ind V and S
SAP Guru's
Query regarding MAP Calculation Logic
Scenario:
*I have one material xyz
1. It is split valuated material,
2. Two valuation types with diff price control indicators
3. Batch Management is also activated on this material.*
Follwoing is the Material Master Accounting1 View :
Vauation Type Price Control Total Value Qty MAP Batch
ZA1 V 610835.00 37 16509.05(V) 01
ZB1 S 0 1 20000.00(S) 02
but when we are running MM03 w/o Valuation Type Accounting 1 View
is showing MAP as 16074.60 i.e. 610835.00/38
Diff. Reports Output------>
MB5L - List of Stock Values: Balances --> Output
ValArea Total Stock Total Value
A101 1 0
A101 37 610835.00
Net--> 38 610835.00
MB52 - Display Warehouse Stocks
Check Box - Display Batch Stocks
Condition1: When Display Batch Stocks is selected on main screen of MB52
Mat. Palnt Sloc Unrestricted Stck in Transit Total Value
xyz A101 0010 0 30 482238.00
XYZ A101 0010 7 0 115563.00
xyz A101 0010 1 0 0
This is not correct result as Total Values is 597801.00 only
Condition2: When Display Batch Stocks is not selected on main screen of MB52
Mat. Palnt Sloc Unrestricted Stck in Transit Total Value
xyz A101 0010 0 30 482238.00
XYZ A101 0010 8 0 128597.00
This is correct result as Total Values is 610835 .00 only
So my query on above issue is :
1. How System is including 1 Qty of Std Price Control for MAP calculation?
As per my understanding MAP is only for Price Control V indicator Materials Stock
2. Whats the difference between these two report output from MM03 Accounting
view?
Thankshi Animesh,
For Split Valuated Material at header level Price control is always "V" i.e. Moving average price reagrdless of the Price control you have given for different valuation types.
Due to this you are getting these kind of results. Please visit the following link for more information
http:///saphelp/EN/8f/d1de34e4cb2300e10000009b38f83b/frameset.htm
Check it and revert back.
Regards,
Jay
Edited by: SAP_MM on Dec 4, 2008 10:19 AM -
Query Designer - Key Figures on the Rows
Hi experts,
I inserted in a query the key figures into the rows.
I would like to see on the report the "KEY" of these key figures and not the "TEXT", but I can't find a way to do that.
Can anyone help me?
TIA
c.Hi,
I developed the couple of reports but iam able to see the text in char and can u tell me where is the option to see key and text for keyfigure.if not is not theere explanin little bit and busines requirement
would like to see on the report the "KEY" of these key figures and not the "TEXT", but I can't find a way to do that. -
Write the sql query to find largest value in row wise without using great
write the sql query to find largest value in row wise without using
greatest fuction?Another not so good way, considering you want greatest of 4 fields from a single record:
SQL> ed
Wrote file afiedt.buf
1 with t as (Select 100 col1,200 col2,300 col3,400 col4 from dual
2 union select 500,600,700,800 from dual
3 union select 900,1000,1100,1200 from dual
4 union select 1300,1400,1500,1600 from dual
5 union select 1700,1800,1900,2000 from dual
6 union select 2100,2200,2300,2400 from dual
7 union select 2800,2700,2600,2500 from dual
8 union select 2900,3000,3100,3200 from dual)
9 SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) Max_value
10 FROM
11 (SELECT (CASE WHEN col1_col2 > col2_col3 THEN col1_col2 ELSE col2_col3 END) col1,
12 (CASE WHEN col2_col3 > col3_col4 THEN col2_col3 ELSE col3_col4 END) col2,
13 (CASE WHEN col3_col4 > col4_col1 THEN col3_col4 ELSE col4_col1 END) col3
14 FROM
15 (SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) col1_col2,
16 (CASE WHEN col2 > col3 THEN col2 ELSE col3 END) col2_col3,
17 (CASE WHEN col3 > col4 THEN col3 ELSE col4 END) col3_col4,
18 (CASE WHEN col4 > col1 THEN col4 ELSE col1 END) col4_col1
19* FROM t))
SQL> /
MAX_VALUE
400
800
1200
1600
2000
2400
2800
3200
8 rows selected.
SQL> Edited by: AP on Sep 21, 2010 6:29 AM -
HOWTO: Perform a Calculation on One Row of a Query
Use this method if you can't perform the calculation at the entity object level--for example, if the calculation involves columns from more than one table, involves transient attributes, or if your view object is pure SQL-based (i.e., not based on any entity objects).
First, you have to generate a view row class.
1. Right-click the view object that represents your query and choose "Edit."
2. When the View Object wizard appears, select the Java page.
3. In the View Row panel, select "Generate Java Class" and "Generate Accessors."
4. Click "Done".
This generates a class called <VoName>RowImpl.java
Next, you should edit the class and add a method that performs your calculation.
1. Double-click the class to bring it up in the source editor.
2. Add a method to perform your calculation, such as the following:
public int sumCol1AndCol2() {
int Col1Val=getCol1().intValue();
int Col2Val=getCol2().intValue();
return (Col1Val + Col2Val);
Next, you need to export your method so that your client can use it.
1. Right-click the view object and choose "Edit."
2. Select "Client Row Methods."
3. In the "Available" list, select the method you just added.
4. Shuttle it to the "Selected" list.
5. Click "Done".
This generates an interface called <VoName>Row containing your method. You should always call <VoName>Row from your client, never <VoName>RowImpl.
Now you're ready to call the method from your client. Here's an example of how you might do it in a JSP client:
<jbo:Row id="myrow" datasource="myVoDataSource" action="Current">
<% out.println( ((myVoRow) myrow).sumCol1AndCol2() ); %>
</jbo:Row>
Note that you have to cast myrow to your interface, since the method you created isn't on the generic interface jbo.Row.
nullUse this method if you can't perform the calculation at the entity object level--for example, if the calculation involves columns from more than one table, involves transient attributes, or if your view object is pure SQL-based (i.e., not based on any entity objects).
First, you have to generate a view row class.
1. Right-click the view object that represents your query and choose "Edit."
2. When the View Object wizard appears, select the Java page.
3. In the View Row panel, select "Generate Java Class" and "Generate Accessors."
4. Click "Done".
This generates a class called <VoName>RowImpl.java
Next, you should edit the class and add a method that performs your calculation.
1. Double-click the class to bring it up in the source editor.
2. Add a method to perform your calculation, such as the following:
public int sumCol1AndCol2() {
int Col1Val=getCol1().intValue();
int Col2Val=getCol2().intValue();
return (Col1Val + Col2Val);
Next, you need to export your method so that your client can use it.
1. Right-click the view object and choose "Edit."
2. Select "Client Row Methods."
3. In the "Available" list, select the method you just added.
4. Shuttle it to the "Selected" list.
5. Click "Done".
This generates an interface called <VoName>Row containing your method. You should always call <VoName>Row from your client, never <VoName>RowImpl.
Now you're ready to call the method from your client. Here's an example of how you might do it in a JSP client:
<jbo:Row id="myrow" datasource="myVoDataSource" action="Current">
<% out.println( ((myVoRow) myrow).sumCol1AndCol2() ); %>
</jbo:Row>
Note that you have to cast myrow to your interface, since the method you created isn't on the generic interface jbo.Row.
null -
BEx Query- Making into Zero value in the blank row/column
Hi All,
I am running a query on multiprovider, say I have three characteristics (sales org, distribution, customer) & key figure (amount) in the layout. I am lookling the actual & plan data in the report. If there is no plan data for the above combination of characteristics, in the report i am getting blank, instead of blank i want $0.00, how to do this?
Regards,
AnandHi ,
Could you please let me know how can we fix this issue. I tried to create a new formula as KF+0 but it did not work.
Hi ,
This issue is in a Bex Query . We are looking for options on how to display blanks as zeros for keyfigures.In the below screen shot highlighted in red there is no data for march 2015 so it needs to display as zero and the overall result should be Zero.
Issue : Overall Result for Cumulative Quantity FTE should pick up the last value which is Mar 2015 instead its displaying 2 as there is no data for Mar 2015.
Thanks,
Bharathi. -
Counting non-blank rows when calculating a cumulative number
Hi
I have tried the below formula and derivations of it (using counta, countax) in trying to create a cumulative number that does not count blank cells/records.
Every variation I try however still counts blank cells/records. Does anyone have any ideas?
=CALCULATE(count(s9JudgeFTC[entity_id]),FILTER(ALL(s9JudgeFTC[ExitMonthCategory]),s9JudgeFTC[ExitMonthCategory] <= MAX(s9JudgeFTC[ExitMonthCategory])),s9JudgeFTC[reentry]=1)
PaulHi Paul,
use "&&" to add filter arguments:
=CALCULATE(count(s9JudgeFTC[entity_id]),FILTER(ALL(s9JudgeFTC[ExitMonthCategory]),s9JudgeFTC[ExitMonthCategory] <= MAX(s9JudgeFTC[ExitMonthCategory])
&& NOT(ISBLANK([entity_id])),s9JudgeFTC[reentry]=1)
Imke -
Futher Calculation on cumulative values
Dear All,
I have a key figure Zsales, on that key figure i have made a calculated key figure and in calculation tab i have checked the tab for CUMULATED value. Now i have to perform futher calculations on this calculated key figure, but in report output i am not getting th e desired values the calculation is being performed on original key figure rather than on cumulated values.
ThanksHi Ravish Singh ,
Actualy CKF is global values,once create CKF in query we can use N number of times but we can get same value in all reports.
if you want change ( or new calculation ) first remove referance (global to local) then only we get correct datas.
in your query coloum or row select ur CKF then right cilck --->remove referance.firest do this then u will get corect values
regards,
sundar -
Query with Top N Condition (Result Row)
Hi,
I made a query with an active top n condition. The query has 2 Keyfigures and 1 formula
Gross-sales acutal | Gross-sales previous year | Previous Year %
So that to result line is correct, I had to say "Calculate result as summation" for the keyfigures
gross sales actual and gross sales previous year. That works.
I have the problem with my formula. the formular for previous year % is defined as follows:
gross sales actual %A gross sales previous year
Example Top 3 Customer
gross sales actual gross sales prev. year prev. year %
Cust 1 100 80 125 %
Cust 2 90 45 200 %
Cust 3 80 60 133 %
Result 270 185 142.8 % ( 350 * 100 / 245 )
The result of 142 % is the correct result without the condition top 3. with the top 3 condition
the result should be 270 * 100 / 185 = 145.9 %
Additional customer without top 3 condition
Cust 4 50 40 125 %
Cust 5 30 20 150 %
It shows the correct result for each single line. The result in the result row is wrong. it is calculated
without taking the active condition. the formular calculates
with the total gross sales actual and the total of gross sales prev. year.
is there any solution the achieve the correct % in the result row?
thanks for your help.
PascalPascal,this is a known behavior with conditions.When you apply condition it just hide the extra rows and it does not impact the result row.So your result row actually shows the value irrespective of the condition you apply.
Now with the help of local functions like calculate result as summation you can show the correct sum after applying the condition but when you try to use that result in some calculation then it takes the original value thereby discarding the calculated value.
Same is happening in your case as well.Its taking the original value i.e 350 and not the calculated sum after condition i.e 270.
Hope this helps.
Regards,
AL
Maybe you are looking for
-
My computer is slow after upgrading to mavericks
I just did the free upgrade to mavericks and now my laptop is running slow...ugh!! ran sophos for any threads and it was all clear. any suggestions???
-
Best practice for calc measures
Hi, I read in one of the olap blog from experts which says that best practice for creating the calc measures is to have them in a seperate cube. My question is that suppose I have two cubes in a AW of different dimensionality. Both the cubes has some
-
Lion 10.7.4 upgrade caused login loop
I upgraded my 2008 MacBook Pro [Intel processor, 4 GB RAM, 250GB HDD to the latest security release for Lion two days ago. I now have a vexing problem. After typing the login password at the login screen OS X Lion 10.7.4 tries to log me in but then
-
I have a MacBook Pro with OSX 10.9.5 When I go to open iMovie, it says "iMovie can't be opened because of a problem. Check with the developer to make sure iMovie works with this version of OSX. You may need to reinstall the application." I updated th
-
Can I access cua SYSTEMS- SUBSYSTEMS using remote BAPI calls
I am using an external application to create users on a SAP CUA system and then push them down to the child systems. I can create the user fine but I cant get the create to actually push the user down to the children. If I create the user natively