Contextoperators in bo 4.0(calculation context using sum)
All,
I am using Webi 4.0 version.I have a scenario in my webi report wherei need to sum up revenue.i want to sum up the sales revenue generated by each employee for a store irrespective of the month.
What i mean is even if the months are different i want to sum the revenuebased on the branch and employee in column G.
My webi report looks pretty much like the below sample.I dont want to apply any breaks or sections,Can i achieve this using context operators or calculation context.
i have tried personally applying context opearators on totalevenue column by applying sum but its not summing up as in column g.
for ex: sum(revenue for each(branchcode))
i want to achieve the totals as shown in column totalrevenue(last column) without applying break or section.
Can any one helpme out.
*Branch>>>>Employee>>Store>>>>Region>>>>>>>Month>>>>>>Revenue>>>>>>TotalRevenue
*A>>>>>>>Dave>>>>>>>D>>>>>>>North>>>>>>>Jan-09>>>>>>>100$>>>>>>>>>
A>>>>>>>Dave>>>>>>>E>>>>>>>south>>>>>>>Jan-10>>>>>>>200$>>>>>>>>>>300$
B>>>>>>>Andrew>>>>>F>>>>>>>east>>>>>>>Feb-09>>>>>>>10000$>>>>>>>>
B>>>>>>>Andrew>>>>>G>>>>>>>west>>>>>>>Feb-10>>>>>>>100000$>>>>>>>110000$
Regards,
Reji.
Edited by: reji2011 on Dec 13, 2011 5:23 PM
Hi Reji,
Yes, there is a reset function for RunningSum() which is something like:
RunningSum([My Measure];([My Dimension]))
and I think the reset dimension has to be in parentheses. You don't have to use the reset part, but it is there if you need to.
Thanks
Similar Messages
-
I've a table including 4 columns as Prod Category, A, B, Ratio.
Ratio = 100*A/B.
If I created a new column named as
Prod Cat (80-20 pareto) = case when rsum(Ratio < 80) then Prod Category else 'All Other Products' end.
I can get the first %80 Ratio Products with its name and the resting is as 'All Other Products'
The problem is If I use Prod Category in my table/pivot table the ratio is being calculated correctly but when I use Prod Cat (80-20 pareto) instead of Prod Category then the ratio is repeat for all rows as 100*sum(A)/sum(B).
The question is for a run-time calculation how can I define its calculation context. I mean how can I tell OBI to calculate the ratio for the following alternatives
1-) row by row ->A/B for each Product category
2-) A/sum(B) -> Ratio for each product category by for all products
Edited by: BIEXP on 30-Mar-2010 10:46Hi ravi,
But some times it will work correctly even though i right click---> create column , i don't think that might be the issue...
Need one more info :
MaxSales=MAX( [SAELSREVENUE] FOREACH [ QUARTER] )
IN ([YEAR]).
what is the main use of IN ( [ YEAR ] ) ( output context ) . is it mandatory to get the output.
can u pls explain a little bit about the output context that we give to get the output.
calculation context -
Introduction
In SQL Server Analysis Services (SSAS), you can create a calculated measure in SQL Server Data Tool (SSDT)/Boniness Integrated Development Studio (BIDS). Sometimes you may need to create calculated measure by using AMO in a C# or VB project.
In this article, I will demonstrate so how to create calculated measure using AMO in SSAS?
Prerequisites
Before create calculated measure using AMO, you need to ensure that the following components were installed in your server.
The multidimensional database AdventureWorks Multidimensional Model 2012
A SQL Server with SSIS and SSAS installed
The AMO libraries installed:
X86 Package (SQL_AS_AMO.msi)
X64 Package (SQL_AS_AMO.msi)
Solution
Here is the detail steps to create calculated measure using AMO in SSAS.
Open SSDT and create a new SSIS project.
Drag Script Task to the design surface.
Click SSIS-> Variables to open the Variables window and add two variables that used to connect to the server and database.
Create a connection to connect to SSAS server.
Rename the connection name to ssas.
Double click the Script Task to open Script Task Editor.
Add Connection and Database variables to ReadWriteVariables textbox and then click Edit Script button.
Add AMO reference in the Solution Explore window.
Copy the script below and paste it into the script.
Dim objServer As Server
Dim objDatabase As Database
Dim strDataBaseID As String
Dim objCube As Cube
Dim objMdxScript As MdxScript
Dim objCommand As Command
Dim strCommand As String
objServer = New Server
objServer.Connect("localhost")
objDatabase = objServer.Databases("AdventureWorksDW2012Multidimensional-EE2")
strDataBaseID = objDatabase.ID
If objDatabase.Cubes.Count > 0 Then
objCube = objDatabase.Cubes("Adventure Works")
If objCube.MdxScripts.Count > 0 Then
objMdxScript = objCube.MdxScripts("MdxScript")
objMdxScript = objCube.MdxScripts(0)
Else
objCube.MdxScripts.Add("MdxScript", "MdxScript")
objMdxScript = objCube.MdxScripts("MdxScript")
End If
objCommand = New Command
strCommand = "CREATE MEMBER CURRENTCUBE.[Measures].[Multipy Measures By 3]"
strCommand = strCommand & " AS [Measures].[Internet Sales Amount] * 3, "
strCommand = strCommand & " VISIBLE = 1 ; "
objCommand.Text = strCommand
objMdxScript.Commands.Add(objCommand)
objMdxScript.Update()
objCube.Update()
End If
objServer.Disconnect()
Then you can run this SSIS package to create the calculated measure.
Applies to
Microsoft SQL Server 2005
Microsoft SQL Server 2008
Microsoft SQL Server 2008 R2
Microsoft SQL Server 2012
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Thanks,
Is this a supported scenario, or does it use unsupported features?
For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
in a supported way?
Thanks! Josh -
How to calculate any two date with diffence calculation by using obiee11g?
Hi,
i have a requirement like,
location wise current month and previous month with movement calculation,can to tell me how to calculate any two date with diffence calculation
by using obiee11g
Note,
I tried to implemented ago function as well as dynamic two dates calculation using $2-$1 methods..but i am getting the o/p it's self i am getiing some null value also that' why it's not tallying with our actual report.
i tired to used ifnull(mesaurecolumn,0) also case condition on the mesaure colution still it's not tallying.
THanks and Rds,
Devarasu.RHi,
for Date Difference........
TimestampDiff(interval, timestamp1, timestamp2)
ex:TimestampDiff(SQL_TSI_DAY, cast('1-apr-2011' as date), current_date)
Where:
interval
The specified interval. Valid values are: SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR.
Cheers,
Aravind -
Getting initial context using a cluster address
I am having trouble getting initial context using a cluster address. My cluster
has two WL 8.1 servers at localhost:8001 and localhost:9001. I set the hashtable
to get the initial context as follows:
env.put(InitialContext.PROVIDER_URL, "t3://localhost:8001,t3://localhost:9001");
This gives me the following exception:
Could not create JNDI InitialContext: javax.naming.ConfigurationException
[Root exception is java.net.MalformedURLException: port expected: t3://cammnbhati:8001,t3://cammnbhati:9001]
Any idea whey this is not working? If I set only one of the addresses then there
is no error. For example, the following works just fine:
env.put(InitialContext.PROVIDER_URL, "t3://localhost:8001");
Thanks.try t3://localhost:8001,localhost:9001 as url
hth
sree
"Naresh Bhatia" <[email protected]> wrote in message
news:4009cfdf$[email protected]..
>
I am having trouble getting initial context using a cluster address. Mycluster
has two WL 8.1 servers at localhost:8001 and localhost:9001. I set thehashtable
to get the initial context as follows:
env.put(InitialContext.PROVIDER_URL,"t3://localhost:8001,t3://localhost:9001");
>
This gives me the following exception:
Could not create JNDI InitialContext:javax.naming.ConfigurationException
[Root exception is java.net.MalformedURLException: port expected:
t3://cammnbhati:8001,t3://cammnbhati:9001
Any idea whey this is not working? If I set only one of the addresses thenthere
is no error. For example, the following works just fine:
env.put(InitialContext.PROVIDER_URL, "t3://localhost:8001");
Thanks. -
Is calculator cache used if there are no blocks created?
Hi experts,
In DBAG it is written -
Essbase can create a bitmap, whose size is controlled by the size of the calculator cache, to record and track data blocks during a calculation. Determining which blocks exist using the bitmap is faster than accessing the disk to obtain the information, particularly if calculating a database for the first time or calculating a database when the data is sparse.
If my calculation does not create any block (it is only dense calculation), but it reads from different blocks on the right hand side of assignment (using cross dim) then is calculator cache used? Is it better to turn off cache in the calculation?
~DebashisThe very next lines in the DBAG entry you quoted from are...
Essbase uses the calculator cache bitmap if the database has at least two sparse dimensions and either of these conditions is also met:
You calculate at least one full sparse dimension.
You specify the SET CACHE ALL command in a calculation scriptSo I would assume the answer is 'no', unless your dense-only calculation also contains 'SET CACHE ALL'. -
I've designed Calculator Program, used by String function
Hello Everyone,
I've designed Calculator Program, used by String function. U've any Feedback in this program, cantact me.
Thanks & Regards,
SABARI SARAVANAN M
Certified LabVIEW Associate Developer
Attachments:
calculator.vi 71 KBHi Jitendra,
Does the dump log shows that the cause is memory shortage?
Thanks and Best Regards,
Vikas Bittera.
**Points for useful answers** -
plz give me a simple example for using SUM in internal table and do some calculations in the same internal table.
HI
CHECK WITH THIS
Syntax
SUM.
Effect
The statement SUM can only be specified within a loop starting with LOOP, and is only considered within a AT- ENDAT control structure. Prerequisites for using the statement SUM include using the addition INTO in the LOOP statement, and that the specified work area wa is compatible with the row type of the internal table. In addition, SUM cannot be used when the row type of the internal table itab contains components that are tables.
The statement SUM calculates the component total with the numeric data type (i, p, f) of all rows in the current control level and assigns these to the components of the work area wa. In the control levels FIRST, LAST, and outside of an AT-ENDAT control structure, the system calculates the sum of numeric components of all rows in the internal table.
Example
Control level processing for creating a list. At the end of line groups, the total of reserved places is calculated and issued.
DATA: sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate,
sflight_wa LIKE LINE OF sflight_tab.
SELECT *
FROM sflight
INTO TABLE sflight_tab.
LOOP AT sflight_tab INTO sflight_wa.
AT NEW connid.
WRITE: / sflight_wa-carrid,
sflight_wa-connid.
ULINE.
ENDAT.
WRITE: / sflight_wa-fldate,
sflight_wa-seatsocc.
AT END OF connid.
SUM.
ULINE.
WRITE: / 'Sum',
sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
SKIP.
ENDAT.
AT END OF carrid.
SUM.
ULINE.
WRITE: / 'Carrier Sum',
sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
NEW-PAGE.
ENDAT.
AT LAST.
SUM.
WRITE: / 'Overall Sum',
sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
ENDAT.
ENDLOOP.
Hope this solves ur problem....
<b>do reward if useful....</b>
regards
dinesh -
Using sum function and round function in single text form field
Hi all,
I have a column Name - A . In the rtf template i have summed up the column A and showing it. But the output is coming as 99.9999997. I want to round it to 100.
I tried using <?round(sum(A),2)?> but dint workout.
I also tried using variables. It is also not working.. I used <?xdoxslt:set_variable($_XDOCTX,’ABS',sum(A)?> and then i used get variable to get it.... But it throwing error while using sum in the set variable step.
Can anyone please help me..
Thanks
SunilHi Sunil,
Calculate the sum into a Variable. and apply round function on the variable to get the desired value.
Calculating sum:
<?xdoxslt:set_variable($_XDOCTX,'v',xdoxslt:get_variable($_XDOCTX,'v')+DOLLARS)?> (its running sum formula,should be placed inside the table to get sum of all rows of particular column)
here Variable 'v' holds the sum value
apply round function:
<?round(xdoxslt:get_variable($_XDOCTX,'v'))?>
Thanks and Regards,
Aravind -
I need to count the number of jobs by year and nature of the job.
I need to calculate also the number only by year (to calculate, later, the percentage). To do this, I tried to use the SUM BY statement:
SUM("- Misure"."Numero Lavori" by "- Inizio Lavoro"."Anno Inizio Lavoro")
Note that the number of jobs is calculated with the COUNT DISTINCT aggregation rule.
Here's the query generated by BI:
WITH
SAWITH0 AS (select count(distinct T6686.CD_LAVORO) as c1,
T6906.ANNO as c2,
T6842.CD_RITORNO_LAVORO as c3
from
L_RITORNO_LAVORO T6842,
L_DATA T6906 /* L_DATA_INIZIO_LAVORO */ ,
F_LAVORO T6686
where ( T6686.ID_RITORNO_LAVORO = T6842.ID_RITORNO_LAVORO and T6686.ID_DT_INIZIO_LAVORO = T6906.ID_DATA )
group by T6842.CD_RITORNO_LAVORO, T6906.ANNO),
SAWITH1 AS (select sum(SAWITH0.c1) as c1,
SAWITH0.c2 as c2,
SAWITH0.c3 as c3,
SAWITH0.c1 as c4
from
SAWITH0
group by SAWITH0.c1, SAWITH0.c2, SAWITH0.c3)
select distinct SAWITH1.c2 as c1,
SAWITH1.c3 as c2,
SAWITH1.c4 as c3,
SAWITH1.c1 as c4
from
SAWITH1
I suspect the part painted in bold shouldn't be there. Anyone can help me?hi,,,,,,
When processing an internal table in a block starting with LOOP and concluded by ENDLOOP , SUM calculates the control totals of all fields of type I , F and P (see also ABAP/4 number types ) and places them in the LOOP output area (header line of the internal table or an explicitly specified work area).
You can use the SUM statement both at the end and the beginning of a control group (see also AT FIRST/LAST ).
Example
Display the table T with sub-totals:
DATA: BEGIN OF T OCCURS 100,
CODE(4),
SALES TYPE P,
DISCOUNT TYPE P,
END OF T.
LOOP AT T.
AT FIRST.
SUM.
WRITE: /4 'Grand Total:',
20 T-SALES, 40 T-DISCOUNT.
ULINE. SKIP.
ENDAT.
WRITE: / T-CODE,
20 T-SALES, 40 T-DISCOUNT.
AT END OF CODE.
SUM.
WRITE: / T-CODE, 10 'Total:',
20 T-SALES, 40 T-DISCOUNT.
SKIP.
ENDAT.
ENDLOOP.
Notes
When you use SUM in a LOOP with an explicitly specified output area, this output area must be compatible with the line type of the internal table.
When using LOOP to process a sorted extract (see SORT ), the control total of f at the end of the group appears in the field SUM(f) - - if f is type I , F or P .
Thanks
Saurabh -
Problem using SUM standard function during Field Mapping
Hi Experts ,
I am trying to sum all LIFMG 's in in the lineitems of a particular
header and map this result to Lifmg of the header.(Idoc with multiple headers and line item).I am using SUM standard function.
Rough Source structure.
Header1
vbeln
....Lineitem1
vbeln
posnr
......LIFMG
....Lineitem2
vbeln
posnr
......LIFMG
Header2
vbeln
....Lineitem1
vbeln
posnr
......LIFMG
....Lineitem2
vbeln
posnr
......LIFMG
I am able to find the SUM ...but in the target structure's Header field I am getting
repeated value of the corresponding sum in each header ...i.e.
Header1
LFIMG-- 100
LFIMG 100
Header2
LFIMG-- 102
LFIMG 102
How to get a single value for each .
Regards,
DeepakSolved Myself ...
Placed sum after if without else ...
placing it before was causing ...those values to be replicated. -
How can i use SUM aggregate in select query?
HI,
GURUS,
How can i use SUM function in Select Query and i want to store that value into itab.
for ex:
TABLES: vbap.
types: begin of ty_vbap,
incluse type vbap,
sum type string,
end of ty_vbap.
data: i_vbap type TABLE OF ty_vbap,
w_vbap type ty_vbap.
SELECT sum(posnr) FROM vbap into table i_vbap up to 5 rows.
(or)
SELECT sum(posnr) FROM vbap into table i_vbap group by vbeln.
loop at i_vbap into w_vbap
" which variable have to use to display summed value.
endloop.
if above code is not understandable pleas give ome sample code on above query.
Thank u,
shabeer ahmed.Hi,
Check this sample code.
TABLES SBOOK.
DATA: COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
DATA: CONNID LIKE SBOOK-CONNID.
SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
INTO (CONNID, COUNT, SUM, AVG)
FROM SBOOK
WHERE
CARRID = 'LH ' AND
FLDATE = '19950228'
GROUP BY CONNID.
WRITE: / CONNID, COUNT, SUM, AVG.
ENDSELECT.
Regards,
Sravanthi -
Using Sum Function in Oracle(on 24 th)
Hi all i wrote the following query.
SELECT RESPONSER_ID,SUM(SUM(DISTINCT WORK_SPACE)) AS SCORE,COUNT(DISTINCT QUESTION_ID) AS QCOUNT FROM TQDB_LEARNER_RESPONSE WHERE RESPONSER_ID=328
GROUP BY RESPONSER_ID
I am getting the following error.
ORA-00937: not a single-group group function
Any body Pls help me.why use sum(sum()
SUM(SUM(DISTINCT WORK_SPACE)) AS SCORE,
SELECT
RESPONSER_ID,
SUM(DISTINCT WORK_SPACE) AS SCORE,
COUNT(DISTINCT QUESTION_ID) AS QCOUNT
FROM
TQDB_LEARNER_RESPONSE
WHERE
RESPONSER_ID=328
GROUP BY
RESPONSER_ID Regards
Singh -
How can I use SUM function to calculate # of employees in the comp.&deptnt?
I've got two tables: employee & department. I am trying to calculate total employees by department and total employees by the entire company. I know I need to use SUM function, but I only can calculate total employees by department & by company separately. I need to get this output:
DEPT_NAME DEPT_TOTAL_SALARY COMPANY_TOTAL_SALARY
RESEARCH 10875 29025
SALES 9400 29025
ACCOUNTING 8750 29025
This is my code:
SELECT department_name, SUM(salary) as total_salary
FROM employee, department
WHERE employee.department_id = department.department_id
GROUP BY department_name;
SELECT SUM(salary)
FROM employee;
Can somebody help please?
Thank you in advance.Edited by: user13675672 on Jan 30, 2011 2:29 PM
Edited by: user13675672 on Jan 30, 2011 2:31 PMHi, Peter
Peter Gjelstrup wrote:
... There might be a smarter way, with no re-select.You're right, as usual.
SELECT d.dname
, SUM (e.sal) AS dept_tot_sal
, SUM (SUM (e.sal)) OVER () AS comp_tot_sal
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
GROUP BY d.dname
;Analytic functions are computed after aggregate functions, so an aggregate function can be nested inside an analytic function.
Another way (without a sub-query, at least) would be SELECT DISTINCT, with only analytic functions.
SELECT DISTINCT
d.dname
, SUM (e.sal) OVER (PARTITION BY d.dname) AS dept_tot_sal
, SUM (e.sal) OVER () AS comp_tot_sal
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
; -
Shadow Instance Left Behind in SLD After Using SUM
Hello,
Is there a standard procedure for removing the SLD information left behind by the creation of shadow ABAP instances when using SUM to update or upgrade systems? Should SUM have some final step for this built in, or should the update instructions include a step to go into SLD and delete the shadow instance information manually?
My situation is as follows. I recently updated the support package stack for my Solution Manager 7.1 system from sps4 to sps12 using SUM (this was for a new installation of Solution Manager). Afterwards, I used SOLMAN_SETUP to perform the System Preparation and Basic Configuration steps, and now I have progressed to Managed System Configuration. The first managed system to configure is Solution Manager itself, and in working on the SolMan ABAP instance, in step 6, 'Enter Landscape Parameters,' I noticed that there is an extra ABAP instance, DVEBMGS03, showing up as a landscape object node. I was puzzled for a bit about this, as there is no instance 03 in my SolMan system, only 00, 01, and 02. Eventually I figured out that SOLMAN_SETUP gets this landscape information from the obvious place, LMDB, which in turn gets it from SLD, and sure enough in LMDB and SLD I can find the "AppServer 03" instance defined.
That's when the light bulb hit. SUM creates a shadow ABAP instance when updating the support package stack (unlike using SPAM), similar to as it does during an upgrade. It deletes the shadow instance at the end of the update, but in the meantime the system has synchronized itself to SLD, and now SLD has a definition for that shadow instance that doesn't go away when the instance is deleted.
It's easy enough to manually delete it in SLD, of course, but that leads me to wonder if there's a preferred option for handling this other than manual manipulation of SLD data.
The version of SUM I used was 1.0 sp11 pl9.
Regards,
MattThat's right, although for a support pack update, I'm not sure if the jobs even get suspended. In the past, when doing this with SPAM, there was no shadow instance to worry about, so it wasn't an issue. In upgrades, when there typically is a shadow instance, things are much more "shut down" in the system (jobs suspended, etc) than is often the case with support pack updates (though perhaps those should be just as much "shut down").
So in future I will definitely keep an eye out for it. Stopping the data supplier should be added to the tool and/or listed as a manual step in the guide to prevent inconsistent landscape and software component data from being replicated (or perhaps it already is and I missed it). I'm going to tag Boris Rubarth to get his take on it, as he is a key player in the development and maintenance of the SUM tool.
Deleting the extra instance in SLD was very easy, and I watched it replicate to LMDB very quickly, and it immediately disappeared upon refresh from the managed system configuration tool. However, it later showed up in diagnostics agent administration, as well, as a warning about a system path not being reachable by the agent (it was trying to reach \usr\sap\SID\DVEBMGS03, which doesn't exist), and so I had to edit the agent landscape paths to remove that as well).
Although the problem is long since solved in my system, as described above, I will keep the question open for a few more hours to see what Boris or others may have to add.
Regards,
Matt
Maybe you are looking for
-
Cisco Valet Connector refuses to be detected by windows
I have bought Three of these products and all three do the same thing. I plug it in, run the setup and the setup never finishes, I can leave it up for hours and it refuses to do ANYTHING. I have talked with Live Chat and have downloaded the drivers,
-
How do I back up my photo stream album photos (not in camera roll) to USB?
Is their a way I can directly save my photo stream to my computer? I have deleted many pictures from my camera roll and wish to keep photos in their respective photostream albums as there are over a thousand! The only way I can seem to do it is to s
-
Electronic Signature Check Printing Products
Hello. Does anyone know of any viable third-party electronic signature check printing products/companies that can be used alongside E-Business Suite (or as a stand-a-lone system)? Our Payables checks right now are manually stamped with 2 signatures a
-
Hi all I have read a lot of posts and blogs now, and I am struggling to see how to format charts beyond the basic properties in the Design Studio user interface. Clearly we need to use CSS, but I am struggling to see how we identify the elements of a
-
Hi, I want to create a partitioned cache in a cluster. I also want entries in the partitioned cache to be removed automatically after a specified amount of time, to be able to reduce the size of the distributed data set. As I understand it, this can