Summing up along a hierarchy
Hi,
I have a requirement... A simplistic explanation of it is...
e.g.
Product Grp1 Sales qty Price Total Sales
Product A 1 200 200
Product B 1 300 300
Sales qty and Price are two separate accounts. I don't have Total Sales as another account but am calculating it in Excel.
Can I force the system to calculate first and the aggregate instead of aggregate and calculate
Any way to calculate the Total Sales at Product Grp1 without using Script logic ?
thanks
Hi Ram,
If you want to store the values of Total Sales, then you need to have this as a member in your dimension. If you want the calculation to happen in the excel, you can keep the formula in the excel sheet only and when you send the data, the data for total sales will also be sent to the database. Alternatively, you can keep a dimension formula for total sales in your dimension.
Hope this helps.
Similar Messages
-
HELP : Summing amounts along a Hierarchy.
Hi All,
I need a query to help me with summing-up amounts along a hierarchy.
Data is only at the lowest level and needs to be summed up along the
hierarchy accordingly. Each level above the lowest level needs to
have an amount that is the sum of amounts in the levels below.
Sample Data:
Id Parent_id Level amount
1 1 0
2 1 2 0
3 1 2 0
4 1 2 0
5 2 3 0
6 2 3 0
7 3 3 0
8 4 3 0
9 5 4 10
10 5 4 10
11 6 4 10
12 8 4 10
13 8 4 10
Desired Output:
Id Amount
1 50
2 30
5 20
9 10
10 10
6 10
11 10
3 0
7 0
4 20
8 20
12 10
13 10
I have tried using the following select but the results
select tn.parent_id,
sum (tn.amount)
from table_name tn
group by tn.parent_id
connect by prior tn.id = tn.parent_id
start with tn.task_id = 1
and the results I get are:
Id Amount
1 0
2 0
5 20
9 10
10 10
6 10
11 10
3 0
7 0
4 0
8 20
12 10
13 10
Am I on the right track and what do I need to modify if so.
Otherwise, will you please suggest a new way to do this ?
Thanks in advance,Like this one ?
SQL> with tbl as
2 (select 1 c1, null c2, 0 c3, null c4 from dual union all
3 select 2 c1, 1 c2, 2 c3, 0 c4 from dual union all
4 select 3 c1, 1 c2, 2 c3, 0 c4 from dual union all
5 select 4 c1, 1 c2, 2 c3, 0 c4 from dual union all
6 select 5 c1, 2 c2, 3 c3, 0 c4 from dual union all
7 select 6 c1, 2 c2, 3 c3, 0 c4 from dual union all
8 select 7 c1, 3 c2, 3 c3, 0 c4 from dual union all
9 select 8 c1, 4 c2, 3 c3, 0 c4 from dual union all
10 select 9 c1, 5 c2, 4 c3, 10 c4 from dual union all
11 select 10 c1, 5 c2, 4 c3, 10 c4 from dual union all
12 select 11 c1, 6 c2, 4 c3, 10 c4 from dual union all
13 select 12 c1, 8 c2, 4 c3, 10 c4 from dual union all
14 select 13 c1, 8 c2, 4 c3, 10 c4 from dual )
15 select c1, c2, c3, c4
16 from (select c1, c2, c3, sum(c4) over (partition by connect_by_root c1) as c4, level lv
17 from tbl
18 connect by prior c1 = c2)
19 where lv = 1;
C1 C2 C3 C4
1 0 50
2 1 2 30
3 1 2 0
4 1 2 20
5 2 3 20
6 2 3 10
7 3 3 0
8 4 3 20
9 5 4 10
10 5 4 10
11 6 4 10
12 8 4 10
13 8 4 10
13 rows selected.
Elapsed: 00:00:00.03Nicolas. -
LookupCube based on CurrentMember of different dimensions along with date range
Hi,
I want to get a value through LookupCube based on CurrentMember of different dimensions along with a date range. For example, I want to make this happen: LookupCube("TMIClaim","([Measures].[Paid Amount],"+"[Transaction
Date].[Hierarchy].[Day].&[2013-01-01T00:00:00]:[Transaction Date].[Hierarchy].[Day].&[2013-02-01T00:00:00]" +"," + "[Product].[Name].&["+[TMI Product].[Name].CurrentMember.Name+"]" +")")).
It does not work as long as I put the date range.
I cannot use Aggregate either since it does not take multiple dimensions as filter criteria. That means when I use date range for aggregate I cannot use another dimensions as filter.
I am looking for any of the solution which based filter that is combined with a date range and other dimensions.
Thanks,
MamunTry using the Sum() function. Something like:
LookupCube("TMIClaim","Sum( ( { "
+"[Transaction Date].[Hierarchy].[Day].&[2013-01-01T00:00:00]:[Transaction Date].[Hierarchy].[Day].&[2013-02-01T00:00:00]
}" +"," + "[Product].[Name].&["+[TMI Product].[Name].CurrentMember.Name+"]"
) , ([Measures].[Paid Amount]," +")
(Check location of parenthesis, but this should point you in the right direction).
This worked for me:
WITH MEMBER MEASURES.LOOKUPCUBEDEMO AS
LOOKUPCUBE("MyCube", "sum({[Date].[YQM].[Day].&[20140330]:[Date].[YQM].[Day].&[20140331]},[Measures].[Row" + " Count])")
SELECT MEASURES.LOOKUPCUBEDEMO ON 0
FROM [MyCube]
Victor Rocca -
Hi All
Can any body help me explain how can we upload data via excel in SSM. Exactly same data in the excel needs to be moved to PAS. For eg the value should not get aggregated at parent level rather display the data the way it is passed through excel.
Right now I'm facing issue that values is getting either summed up or avg at parent node and not picking the value passed through excel.
Where and what setting needs to be changes to resolve my issue.
Regards
RohiniHi Rohini,
If you are already loading values at all levels of the dimension, you won't need to run the consolidation for those metrics.
You do have to run the consolidation for the metrics to which you are only loading INPUT data.
And if you have metrics for which the members should get aggregated along the hierarchy using only SUM or AVERAGE, then you can choose to load all the hierarchy, or just the INPUT members with a consolidation running afterwards. Loading INPUT members and consolidate could have better performance. Also, if you need to change just one member of the dimension for the metric, you wouldn't need to load the full hierarchy, a consolidation would ensure all values were consistent.
Regards,
Ricardo -
I have a cube hierarchy that has full path
[Location].[Location Hierarchy].[Department].&[DEPT 07].&[East].&[Manager].&[site code]
I can return the full hierarchy using something like
[Location].[Location Hierarchy].[All]
However, I want to return everything ([All]) at a lower level of the hierarchy. For example,
[Location].[Location Hierarchy].[Department].&[DEPT 07].&[All]
To get everything in Dept 07.
Of course your first response would be - just use the same statement without ALL
[Location].[Location Hierarchy].[Department].&[DEPT 07]
but the problem is I want to use a lookup cell that allows the user to select All, East, or West
=Cubemember("MyCube","[Location].[Location Hierarchy].[Department].&[DEPT 07].&[" & B1 & "]")
And that works for East and West, but not All, because I can't just append [All] partway down a hierarchy to get everything underneath (at least as far as I can tell).
Can anyone throw me a hint on how to accomplish a dynamic cubemember formula that includes/allows an All option?
I even tried embedding the cubeformula in an IF statement (If B2="All", Cubemember(formula1), Cubemember(formula2)) but Excel didn't like that either.
Thanks for any help!!If you want to display the sum for a given hierarchy level, you should use CUBESET function.
e.g.
=IF(B2="all",CUBESET("mycube","[Location].[Location Hierarchy].[Department].&[DEPT 07]","all"),Cubemember("MyCube","[Location].[Location Hierarchy].[Department].&[DEPT 07].&["&B1&"]"))
Hope it helps. -
Displaying ALV hierarchy at a certain level
Hi all,
I have an ALV report that shows a hierarchy. This ALV hierarchy is created using std class CL_GUI_ALV_TREE.
The number of hierarchy levels is dynamic and only determined during run time. However I would like to be able to either display all nodes expanded or only the last node unexpanded. In other words I would like to control which hierarhcy level is expanded when the report is first displayed.
Can anyone suggest a way to do this please?
ThanksIf you want to display the sum for a given hierarchy level, you should use CUBESET function.
e.g.
=IF(B2="all",CUBESET("mycube","[Location].[Location Hierarchy].[Department].&[DEPT 07]","all"),Cubemember("MyCube","[Location].[Location Hierarchy].[Department].&[DEPT 07].&["&B1&"]"))
Hope it helps. -
Hierarchy based non-cumulative reporting
BI Gurus,
I am dealing with a data model with all cumulative "summation" type key figures. These are hours logged by an employee. There is also an employee hierarchy which defines the reporting structure. Now the requirement is to create two reports: (1) Cumulative and (2) non-Cumulatibe report. Non-cumulative along the hierarchy nodes that expand. The catch is to show the logged employee hours at each level. So, a manager should only see his own hours on his row and not the cumulative of his plus his direct reports. The org structure of the hierarchy needs to be maintained in the report though.
One other issue is that the hierarchy being used has all the nodes postable. Perhaps a new text node based hierarchy may be a viable option but please advise if anyone has any other thoughts.
Thanks
Edited by: Ron on Jul 7, 2008 9:19 PMHi Vikas,
Authorizations Steps -http://help.sap.com/saphelp_nw2004s/helpdata/en/be/076f3b6c980c3be10000000a11402f/content.htm
Example http://help.sap.com/saphelp_nw04/helpdata/en/41/05453caff4f703e10000000a114084/frameset.htm
Authorizations - Reporting
Assign points if this helps.
Regards,
Anil -
Inclue children and exclue children in a single hierarchy in parent child dimension in mdx
hi,
include children and exclude children in a single hierarchy in parent child dimension in mdx
*12-parent
**20-parent
- 9-parent
--250-child1
--210-child2
--240-child3
aggregation of 12-parent only
aggregation of 20-parent only
aggregation of 9 with children
regards,
ManishHi manishcal16PPS,
According to your description, you have a parent child dimension in your cube. Now you want to use one measure use show aggregation value including/excluding child member based on different parent level member. Right?
In this scenario, we could use IIF() in the calculated measure to apply different calculation depends on the current dimension member. Please refer to query below:
with member [x] as
IIF([Dim].[Hierarchy].CurrentMember is [Dim].[Hierarchy].[Parent].&[9]
sum(Descendants([Dim].[Hierarchy].CurrentMember,
[Date].[Calendar].[Parent]),
[Measures].[Amount])
sum([Dim].[Hierarchy].CurrentMember,[Measures].[Amount])
select [x] on 0,
[Date].[Calendar].[Parent].members on 1
from
[Cube]
Best Regards,
Simon Hou
TechNet Community Support -
Mdx : Sum up the measure from start but need only non empty rows
Hi All
i have created a calculated measure where it suming up all its previous avaialable values based on Date dimension.
Everything is working but we are getting all rows from that datetimension . how can get only till current date,
SUM(NULL:[Date].[Hierarchy].currentmember,[Measures].[SIMID])
Surendra ThotaHi Surendra,
According to your description, you want to calculate the sum up the measure from start for those non empty rows, right?
In this case, please try the query below.
WITH MEMBER [Measures].[Sum from start]
AS
SUM ({NULL:[Date].[Calendar].CurrentMember},
[Measures].[Internet Sales Amount])
SELECT {[Measures].[Internet Sales Amount],[Measures].[Sum from start]} ON 0 ,
nonempty([Date].[Calendar].[Calendar Year].MEMBERS) ON 1
FROM [Adventure Works]
Result
Besides, here is a blog which describe various way to calculate running total, please see:
http://blog.sqltechie.com/2011/01/various-way-to-calculate-running-total.html
Regards,
Charlie Liao
If you have any feedback on our support, please click
here.
Charlie Liao
TechNet Community Support -
How to show the right ps-budget in an hierarchy
Hi Gurus,
I have got a question regarding to Budget for PS. We are loading this data (0CO_OM_WBS_8) to a Cube and
also load the hierarchy for the WBS-Element. The budget logic is that a budget of a certain level will be included
in the level above. For example, Level 3 gets a budget of 500,- EUR, then this 500,- EUR will also be booked to
level 2 and level 1. If I now create a query with the hierarchy for the wbs element, it sums the values over the hierarchy levels so that I get 1000,- EUR on level 1. What do I have to do to solve this problem ???
Level 1 1000,-
|----
> Level 2 500,-
|----
> Level 3 500,-
thanks for your contribution in advanced.
DanielHi SDBI,
I am working with a characteristic hierarchy and the level are not adjacent to each other. The problem is that the
CO bookings on level 3 will be also included on level 2 and level 1 and therefore I can not use the sum function
of the hierarchy. Is there any other logic I can use ???
My example was not right here again.
Data in the cube
WBS-Element Level 0Amount
PADE03.211.3 L3 1000, -
PADE03.211.2 L2 1500,- (1000 from L3 + 500 spend on l2)
PADE03.211.1 L1 1500,- (1000 from L3 + 500 from L1, no budget on L1)
Display in Hierarchy
PADE03.211.1 L1 4000,-
*PADE.03.211.2 L2 2500,-
**PADE 03.211.3 L3 1000,-
but I would like a display like
PADE03.211.1 L1 1500,-
*PADE.03.211.2 L2 1500,-
**PADE 03.211.3 L3 1000,-
Daniel
Edited by: Weilbacher Daniel on Jul 6, 2008 7:53 PM -
Suppressing aggregation in Hierarchy
Hi,
Hi,
We are getting following data from ECC for WBS
WBS_____________Cost_______POC(%)
WBS1____________ 00_________40
WBS1.1___________70_________60
WBS1.2___________50_________20
Requirement is to show cost & POC along WBS hierarchy
WBS________________Cost_______POC(%)
WBS1_______________120________40
|--->WBS1.1___________70_________60
|--->WBS1.2___________50_________20
When we are creating report, it is basically aggregating all values of WBS 1, 1.1 & 1.2 like following
WBS________________Cost_______POC(%)
WBS1_______________120________80
|--->WBS1____________ 00_________40
|--->WBS1.1___________70_________60
|--->WBS1.2___________50_________20
In this we can hide WBS1 in the leaf node, but still problem remains with WBS1 in the parent node showing aggregated value (80) instead of actual value (40).
Has anyone done like this before? Appreciate your help...!!!
Thanks & Regards,
Vikram.Hi,
I am able to achieve this using the Exception aggregation - "No aggregation of Posted Nodes along Hierarchy" property of CKF. Now its working fine.
- Vikram. -
Are Cube organized materialized view with Year to Date calculated measure eligible for Query Rewrite
Hi,
Will appreciate if someone can help me with a question regarding Cube organized MV (OLAP).
Does cube organized materialized view with calculated measures based on time series Year to date, inception to date eg.
SUM(FCT_POSITION.BASE_REALIZED_PNL) OVER (HIERARCHY DIM_CALENDAR.CALENDAR BETWEEN UNBOUNDED PRECEDING AND CURRENT MEMBER WITHIN ANCESTOR AT DIMENSION LEVEL DIM_CALENDAR."YEAR")
are eligible for query rewrites or these are considered advanced for query rewrite purposes.
I was hoping to find an example with YTD window function on physical fact dim tables with optimizer rewriting it to Cube Org. MV but not much success.
Thanks in advanceI dont think this is possible.
(My own reasoning)
Part of the reason query rewrite works for base measures only (not calc measures in olap like ytd would be) is due to the fact that the data is staged in olap but its lineage is understandable via the olap cube mappings. That dependency/source identification is lost when we build calculated measures in olap and i think its almost impossible for optimizer to understand the finer points relating to an olap calculation defined via olap calculation (olap dml or olap expression) and also match it with the equivalent calculation using relational sql expression. The difficulty may be because both the olap ytd as well as relational ytd defined via sum() over (partition by ... order by ...) have many non-standard variations of the same calculation/definition. E.g: You can choose to use or choose not to use the option relating to IGNORE NULLs within the sql analytic function. OLAP defn may use NASKIP or NASKIP2.
I tried to search for query rewrite solutions for Inventory stock based calculations (aggregation along time=last value along time) and see if olap cube with cube aggregation option set to "Last non-na hierarchical value" works as an alternative to relational calculation. My experience has been that its not possible. You can do it relationally or you can do it via olap but your application needs to be aware of each and make the appropriate backend sql/call. In such cases, you cannot make olap (aw/cubes/dimensions) appear magically behind the scenes to fulfill the query execution while appearing to work relationally.
HTH
Shankar -
Aggregation problem in Qery design
Hi folks,
I have the following situation:
- Characteristics as line items, shown as a hierarchie.
- KFs and Formulars in columns
I want the formulars to be calculated on the basis of a combination of two of the characteristics (the bottom two in the lines hierarchy) and then aggregated.
Exception aggregation allows me to choose "total" based on one characteristic, but not a combination of two.
One solution would be, of course, to create a new characteristic in the cube that is a combination of the two existing characteristics in question and then use this for exception aggregation. This would be a bit complicated though, as the two characteristics are in fact navigational attributes of characteristics that appear in the data source and the cube.
Therefore, I'd prefer a solution that is in the scope of query designer rather than cube design.
Any ideas?
PS: The formulars show correct values on the level of the bottom most characteristic in the lines hierarchy if I choose that characteristic for exception aggregation. The results are not correct one level up from there as I can not get the system to sum the results up along the hierarchy. Instead, they are calculated for the aggregated values of the KFs used in the formular.
Apparently the "show lines as hierarchy" function really only affects display of the lines, not calculations.Hi John,
I understood your problem. Solution is easy:
Make formula 1, exception aggregation as total , ref char as char 1
Then make another formula 2 on formula 1, exception aggregation as total , ref char as char 2.
And in the report show formula 2 and hide formula 1.
Best Wishes,
Mayank -
Analysis Auth issue - multiple objects
Currently we have different roles define for each separate section of our business with Comp code and Profit center (along with Hierarchy on PC).
For e.g.
Section 1
Company Code u2013 1010,1050,1500,1520,1700,1800
Profit Center u2013 150000 u2013 159999 and Profit Center hierarchy u2013 ZPROFIT_CTR_GROUP/99991231/G_15
Section 2
Company Code u2013 1110,1150,1500,1520,1700,1800,1980,2050
Profit Center u2013 190000 u2013 199999 and Profit Center hierarchy u2013 ZPROFIT_CTR_GROUP/99991231/G_19
Currently there are 30 such roles define, we have quite a segregation within the business. So each BW user generally has one of the 30 roles assign to them. This is working perfectly fine.
Now because of the consolidations, there are some users who would manage information from different section. So now a user can have access to Section 1 as well as Section 2. Whenever we tried giving access to 2 roles directly to any user, the results of the query comes back as u201CNo Authorizationu201D
If you notice in the difference between section 1 and 2 is additional company code and some matching company codes along with that is complete different Profit center range and profit center hierarchy node. I am not sure where exactly it is failing.
Now one more thing for you information is that we have defined Auth variables on Company code (input/Auth/multiple Values) and Profit Center (Input/Authorization/Selection) and Profit Center hierarchy (hierarchy node variable / Authorization)
I am just trying to understand where the No Auth error msg is coming. Is there some intersection which is killing the query result itself?
Please let me know if any of you have any suggestion.A common problem when authorizing using two different Characteristics is how the authorization variables are filled.
If a user has access to both section 1 and section 2, a authorization varible for Company Code will contain the values
1010,1050,1500,1520,1700,1800, 1110,1150,1980,2050
and the authorization variable for Profit Cetre will contain
150000 u2013 159999 and 190000 u2013 199999
If the user doesn't restrict the query further, the system will issue a correct authorization error since the user is not authorized for the selection CC=2050 PC=150000 and all the other "cross-combinations".
Try creating variants of the selection screen for section 1 and section 2 respectively and force the user to select one of these when executing the query.
Regards,
Lars -
Questions about Integrated Planning and BPS
Hi all,
I'm testing the functions of BW7.0. And at the point of comparing the new BI Integrated Planning from the BPS, I'm stuck with 3 problems. Can anybody give me some solution?
<b>i.</b> When using the input-ready layout of the BW-BPS 3.5, I was able to create a new record and load it up to the cube. Is it possible to make the same operation like this using the BI Integrated Planning of BW7.0?
<b>ii.</b> When using the BW-BPS 3.5, showing the character hierarchy on the Manual planning layout can be chosen. And I'd like to show the BPS Characteristic Hierarchies in BI Integrated Planning of BW7.0 like it is in the BW-BPS 3.5. Is it possible to show the hierarchy in similar type somehow? If not,can't I show the sum of it anyhow? And if possible,can you also show the sum of the each hierarchy and change the data?
<b>iii.</b> When showing the Characteristic combination data, can you choose how to show them from the transaction data or from all the combination like it was possible in the BW-BPS 3.5?
Kind regards,
Hiroshi IwanagaDear Beat,
Thanks for your help.
The information you gave me made a lot of help.
Can I ask you more about the first question?
About getting new lines in the table web item,as you have told me, I have set the parameter NEW_LINES_COUNT as 20 in the table web item. But when I execute it,no lines shows up. Is this a program error or am I setting the parameter in a wrong place?
And this getting new lines feature, is it also possible when using a workbook?
Thanks in advance,
Hiroshi Iwanaga
Maybe you are looking for
-
Delays in data transfer.. server-to-client
All, We are experiencing delays in object transfer between server and client. The delays are longer with large objects (a single object with an array of objects that reflect the rows returned in a database) than small (ie: 10 rows vs 400). Does anyon
-
DVD drive does not recognize some media on Satellite A30-514
I own a Satellite A30-514 laptop with Microsoft xp OS. Just lately, some DVD's (not games) will not play from the drive. some do some don't. It is not a region problem - they are all region 2. Windows does not read the disc when it is inserted and do
-
COMException when runnung BasicIACJsoVB (Acrobat Standard 8.1.2)
Hello, i am using VB 2008 and the Adobe SDK with an XFA-based PDF-Document. Acrobat Standard 8.0 is installed on my machine. additionally i executed three Patches to upgrade it to version 8.1.2. I tried some samples that worked fine, but the most int
-
Messages not saved in Adobe Send
I'm not finding any way to access the messages that were sent to recipients in Adobe Send. I can access the files that were sent and see who they were sent to and the date they were sent, but I'm unable to find the messages that were written to the
-
How to set multiple query names to BIApplicationFrame?
Hi, I have to integrate BI reports in webdynpro.For this purpose i am using BI Application Frame UI element. From BW if there is one query for one templet i am setting the following properties like ...... dataproviderstatename - xxxxxxxx(queryname) d