Different aggregation operator for two measures in single cube

Hi,
I have three measures age_month and age_year,pages for which aggregation operator should be like this
for age_month and age_year
time - max
account - sum
sales org - sum
for pages
time - sum
account - sum
sales org - sum
I am creating MOLAP cube in OWB and deploying to AWM. I can create above structure in OWB but when I deploy it to AWM I see that for all the dimensions and all the measures aggregation operator as sum. Off course I can change the aggregation operator at cube level but it make changes to all underlying measures too.
Also I can see in XML of the cube and see the operator for two measures is as max but UI shows as sum. After load also I am seeing in report it is calculating as sum instead of max along time dimension.
Any help would be highly appreciated.
Thanks
Brijesh

If you have an existing cube (already defined and aggregation setup) then modifying the aggregation behavior like changing order of dimensions/aggregation operators is not very robust (likely to fail due to inability of internal objects to sync up to modified defintion). Its always better to take a backup of cube definition and drop/rebuild a fresh cube with new dim order/agg operators.
How can you have a compressed cube and also set the aggregation property per dimension?
I was under the impression that if it is a compressed cube, then not only is there a restriction that all measures have same aggregation properties (defined at cube level) but also the aggregation behavior defined at cube level should use the same operator (note: any one operator out of sum or max or min) for all dimensions.
Edited by: Shankar S. on Dec 19, 2008 11:54 AM
Perhaps this additional restriction is only required if we intend to use the Cube as a source for relational queries using Cube organized MVs.
Another way to do this is given below:
I'm assuming that when you say that you require Max along Time and Sum along other dimensions, you mean that you want LAST (chronological) along time at leaf level and SUM along other dimension. Also assuming that Time hierarchy has the following levels: DAY, MONTH, QUARTER, YEAR. Big assumption :) as finding out Max along time requires the help of the fact/measure whereas finding out last along time requires us to use the dimension (along with dimension metadata) alone.
Define 1 Cube: Cube1 ... Structure: Compressed Composite, datatype: DECIMAL
Set Aggregation: SUM along all dimensions
Create 3 stored measures ( age_m_sto, age_y_sto and pages)
You may want to set description for age_m_sto/age_y_sto as "******** INTERNAL: DO NOT USE ******** Stored Measure used for age_month/age_year"
Create 2 calculated measures - age_month and age_year defined as follows ...
olap expresssion to be given in AWM:
<age_month>: OLAP_DML_EXPRESSION('cube1_age_m_sto(time if time_levelrel eq ''DAY'' then time else statlast(limit(time to bottomdescendants using time_parentrel time(time time))))', DECIMAL)
<age_year>: OLAP_DML_EXPRESSION('cube1_age_y_sto(time if time_levelrel eq ''DAY'' then time else statlast(limit(time to bottomdescendants using time_parentrel time(time time))))', DECIMAL)
NOTE: The caculated measure performs the LAST along time action using the stored measure. For every higher level time dimension member, it reaches along the dimension to the last leaf level member and reads the stored measure for that lowest level time member.
Map and Maintain Cube.
From the SQL Cube View: Use only the columns corresponding to stored measure: pages and calculated measures: age_month, age_pages (ignore columns corresponding to age_m_sto, age_y_sto)
HTH
Shankar

Similar Messages

  • Different aggregation operators for the measures in a compressed cube

    I am using OWB 10gR2 to create a cube and its dimensions (deployed into a 10gR2 database). Since the cube has 11 dimensions I set all dimensions to sparse and the cube to compressed. The cube has 4 measures, two of them have SUM as aggregation operator for the TIME dimensions the other two should have AVERAGE (or FIRST). I have SUM for all other dimensions.
    After loading data into the cube for the first time I realized that the aggregation for the TIME dimension was not always (although sometimes) correct. It was really strange because either the aggregated values were correct (for SUM and for AVERAGE) or seemed to be "near" the correct result (like average of 145.279 and 145.281 is 145.282 instead of 145.280 or 122+44+16=180 instead of 182). For all other dimensions the aggregation was OK.
    Now I have the following questions:
    1. Is it possible to have different aggregations for different measures in the same COMPRESSED cube?
    2. Is it possible to have the AVERAGE or FIRST aggregation operator for measures in a COMPRESSED cube?
    For a 10gR1 database the answer would be NO, but for a 10gR2 database I do not know. I could not find the answer, neither in the Oracle documentation nor somewhere else.

    What I found in Oracle presentation is that in 10GR2 compressed cube enhancements support all aggregation methods except weighted methods (first, last, minimum, maximum and so on). It is from September 2005 so maybe something changed since then.
    Regarding your question about the results I think it is caused by the fact that calculation are made on doubles and then there is a compression, so maybe precsion is lost a little bit :(. I really am curious whether it is because of numeric (precision loss) issues.

  • How to use two different ojdbc14.jar for two web application.

    Hi,
    I have two web application running in same tomcat, I need to use the two different ojdbc14.jar for two application, now both are taking the jars from tomcat common/lib directory, I tried copying the new ojdbc14.jar in web-inf/lib folder of one application, but it is not working.
    Could you please let me know whether this will take the jar from tomcat by befault or from web-inf, and a solution how to proceed with this.
    Thanks in advance.

    Yes, I tried removing the jars from common/lib, but as the connection string is mentioned inside the server.xml it is showing db connection error while trying to connect to the database

  • Different Pricing date for two line items

    Hi guru's
    How to give different pricing dates for two line items
    in a sales order
    To elaborate
    I have two line items one i need pricing date order date
    second one i need pricing date should be delivery date
    Thanks in advance
    Srinivas

    Dear Srinivas,
             While creating sales order select the item which you want to change the pricing date then go to menu>GOTO>Item -->Click on Sales A here you can able to change the pricing date as you like.
    You can change the pricing date of the item in the sales order through sales order change mode but that sales order should be open.
    I hope it will help you,
    Regards,
    Murali.

  • How do I create different contacts lists for two iphone/users?

    How do I create different contacts lists for two iphone/users?

    Sorry. This doesn't make a lot of sense. Each iPhone user should have their own cloud accounts with which to sync contacts.
    The iPhone is not a multi-user device.

  • Different pricing procedures for two different items in a sales order.

    Hi ,
    In a sales order I have two items , one is TAN item and other item is TAD (services).. Since the tax structure is different for above mentioned items, user wants to apply two different pricing procecdures for two items in a sales order.
    Can any one suggest how to get this functionality.
    Thanks,
    Ashok S

    Dear Ashok,
    As Rithivika rightly mentioned that in one sales oder you can't get two pricing procedures.
    Because pricing procedure determination will takes place based on these combination
    Sales areaDocument pricing procedureCustomer pricing procedure-->Pricing procedure.
    So If you want different pricing procedure either one of the combination should be different.
    But you try this
    You can maintain service related tax condition types also in the same procedure,but when you maintain condition record you can maintain material wise.
    So when you create sales order system will pick the pricing based on the material(standard item or service item).
    I hope this will help you,
    Regards,
    Murali.

  • Override Aggregation specification for a measure in AWM

    Hello,
    I have a created a cube using AWM (10.2.0.1). I have 2 measures in this cube. I want each one of the cube to have a different aggregation specification.
    There is an option in AWM to override the aggregation specification while creating the measure, but this option is greyed out. Why is this disabled and what should I do to enable this option.
    Thanks in advance for your help.
    Regards,
    Maruthi

    Hello,
    When I create the cube I left the 'Use Compression" option checked and that is the reason why I don't get to override the aggregation specification while creating the measures.
    Regards,
    Maruthi

  • AWM Set Aggregation Operator based on Measure instead of Dimension?

    Is there anyway to base an operator of a measure over a dimension on the measure instead of the dimension? In AWM, I notice that each Measure has an Aggregation tab that summarizes its operator over each dimension, but it is greyed out. The way I'd like it to work is to have one Measure be summed over the Dimensions, while another Measure is averaged over the Dimensions.

    Found my answer: Not only do I need to make sure my cube is not compressed, but I also need to select "Override the Aggregation specification of the cube" under each Measure's General tab. This results in the contents of the Aggregation tab no longer being grayed out.

  • Different voicemail message for two online numbers...

    I have two online numbers. How can I set up a different voicemail message for my second online number? It currently plays the message I set up for my first online number and I see no way to do a message for each number. Do I have to have to set up a whole different Skype account, add an online number to it, just to have a different voicemail message?

    I was just asking the same thing...

  • How to use Batch operation for two xsodata services?

    Hi All,
    I have two xsodata services. How to use submit batch for two xsodata services
    Thanks,
         Mj

    Gateway Batch Calls from SAPUI5

  • Is there a way to apply different dimension filters to two measures

    Dear all,
    Let's say I have a report that goes something like below:
    TIME DOLLARS FORECAST DOLLARS
    JAN 99999 99999
    FEB 99999 99999
    MAR 99999 99999
    APR 99999 99999
    MAY 99999 99999
    DEC 99999 99999
    What I would like to achieve is this:
    TIME DOLLARS FORECAST DOLLARS
    JAN 99999
    FEB 99999
    MAR 99999
    APR 99999
    MAY 99999
    DEC 99999
    i.e. DOLLARS displayed only for first two months (or whatever. May be because the report is being run in March). And for rest of the year I display forecast.
    Please note that I do not want to achieve the above with the help of "formatting".
    What I am looking for is "an ability to apply two separate filters (for the same dimension) on two different measures in the report". i.e. in the above case DOLLARS has a filter of JAN to FEB; and FORECAST has a filter of MAR to DEC.
    How can I do this in Discoverer? Any hint/ pointers are greatly appreciated.
    Cheers.
    pxsheth.

    Hey there.
    I'm not sure exactly what you mean when you say you don't want to achieve with help of formatting.
    See if this suggestion makes sense - and doesn't fall into that formatting camp.
    The only way to add a column in Discoverer is via calculations.
    So if you have a column called dollars and one called forecast_dollars then I would think you'd want to determine the month of the run date - or ask user what month they want to run it for.
    You don't say how you determine forecast_dollars but let's just say all the columns come from data.
    So could you not have a condition that brings back the data for a date range (ie: current year or ask user for from / to dates). Then:
    calc_dollars calculation: equals the dollar amount brought back from the query if record month <= current month else 0.
    calc_forecast_dollars calculation: equals the dollar amount brought back from the query if record month > current month else 0.
    So in practice:
    table A has 3 columns: time, dollars, forecast_dollars
    condition: where time between from_date_parameter and to_date_parameter
    calc_dollars: SUM(case when time <= SYSDATE then dollars else 0 end)
    calc_forecast_dollars: SUM(case when time > SYSDATE then forecast_dollars else 0 end)
    That gets you a time column, a dollars columns and a forecast_dollars column.
    In your example, it appears you want forecast_dollars in the same column. I'm assuming this is incorrect but if you wanted it, you'd just have one calculation such as:
    calc_bucks: (case when time <= SYSDATE then dollars else forecast_dollars end)
    So, is this the kind of thing you want or would this be more formatting?
    Russ

  • How to calculate different tax rates for  same material in single invoice.

    Dear All,
    If the excise rates are changed during the budget and the stock is lying with the client with the existing rate.
    After effective date of new rates we receive the good with new rates.The new and the old rate stock is sent to a customer in single invoice.How can we configure such case. The excise should calculate by old rate to old stock and new stock should be calculated by new rate.
    Please guide in such case.
    Thanks in advance.
    deepti

    Hi Deepti
    In copy control you will have to redeterfine taxes whilst billing.
    If you want you change this and keep it as copy pricing. This won't change anything. Else use Copy prices and redetermine tax. You can find this setting in VTLA and VTFA in item category Pricing type.
    You can't have both of then in the same invoice as procedure is decided for the whole invoice and not a single Item. You can rather have two different item category type. TAN and ZTAN you redetermine taxes for tan and copy them as it is for ZTAN.
    Regards

  • Different material group for two CO companies with same material no.

    Hi all
    We are implementing another CO company in COPA. The issue is  that both companies use the same materials number, but in COPA grouping categories (MATKL) must be different . I was thinking in using another category, but is there another option?

    Hi,
    By definition the materials should have the same material group (operationg concern - same market grouping).
    However, if you have this as business requirement you need to first identify a field to store this.  and then you an also use exit / derivation rule  to replace the value with a condition on the company code.  Advantage you have reduced the use of one more characteristic in CO-PA.
    Hope this helps you.
    Varadharajan

  • How to define an aggregation rule for a dimension based on bridge table?

    Hello,
    I need a solution for aggregating data correctly when using a dimension based on a set of dimensione tables containing a bridge table. Please find below a description of my business case and the OBIEE model which I’ve created thus far.
    Business Case
    The company involved wants to report on the number of support cases, the different types of actions that were taken and the people involved in those actions. One support case will undergo a number of actions (called ‘handelingen’) until it is closed. For each action at least one person is involved performing a specific role, but there can also be multiple persons involved with 1 action, each performing a different role for that action. This is the N : N part of the model.
    The problem that I face is visible in the two pictures below:
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/sample.png
    As long as I don’t include anything from the Dimension Meelezer in my report, I get the correct number of handelingen (7). When I include the person (called ‘Meelezer’), the measuere per action is multiplied by the number of persons/roles involved with that action.
    When I changed the Aggregation rule in the report column #Handelingen to ‘Server Complex Aggregate’ I do get the correct endtotal:
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/sample2.png
    I believe it should be possible to define in the repository a different aggregation rule for individual dimensions, but I’ve not been able to achieve this.
    Explained below is what I have created in my Physical and Business Model & Mapping layers:
    The Physical Model is built like this:
    (This is just a small part of a much larger physical model, but I’ve only included the most relevant tables)
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/PhysicalDiagram-1.png
    The Fact table (ALS Feit Zaakverloop) contains FK’s for the action (FK_HANDELING, joined to ALS Dim Handeling), the date the action took place (FK_DATUM_ZAAKVERLOOP, joined to ALS Dim Datum Zaakverloop) and the uniqe group of people involved (FK_MEELEZERS, joined to ALS Groep Meelezers) and a measure column (SUM_HANDELINGEN) populated with the value ‘1’ for each row.
    The Bridge table (ALS Brug Meelezer/Reden Meelezen) contains three FK’s: FK_GR_MEELEZERS (joined to ALS Groep Meelezers), FK_MEELEZER (joined to ALS Dim Functionaris) and FK_REDEN_MEELEZEN (joined to ALS Dim Reden Meelezen).
    The Business Model
    In the business model, the four physical tables for the N:N relation have been combined into one logical dimension table.
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/BusinessModel-1.png
    DIM Meelezer contains one LTS in which the four physical tables have been combined:
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/LTS1.png
    And all the required locical columns have been created:
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/LTS2.png
    DIM Meelezer has also been identified as a bridge table and a Business Key has been defined on a combination of the FK’s in the bridge table and business codes of the two dimension tables.
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/BMDIM.png
    Next a hierachy was created for Dim Meelezer:
    http://i84.photobucket.com/albums/k24/The_Dutchman_2006/OBIEE/Hier.png
    In Feit Zaakverloop, a measurement called ‘# Handelingen’ was created using SUM_HANDELINGEN, with an aggregation rule of SUM.
    In the LTS of both the DIM Meelezer and Feit Zaakverloop, the Logical Content Levels have both been set to: LVL Detail – Meelezer.
    Please provide suggestions that will NOT require changes to the physical datamodel as they would require too much time to achieve (or at leats would not be ready before my deadline.
    Thanks!
    Edited by: The_Dutchman on Dec 13, 2011 11:43 AM

    Hmm, no replies yet...
    Am I in 'uncharted territory' with this issue?

  • Query rewrites with Nested materialized views with different aggregations

    Platform used : Oracle 11g.
    Here is a simple fact table (with measures m1,m2) and dimensions (a) Location (b) Calendar and (c) Product. The business problem is that aggregation operator for measure m1,m2 are different along location dimension and Calendar dimension. The intention is to preaggregate the measures for a product along the calendar dimension and Location dimension and store it as materialized views.
    The direct option is to define a materialized view with Inline queries (Because of the different aggrergation operator, it is not possible to write a query without Inline query). http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28313/qradv.htm#BABEAJBF documents the limitations that it works only for 'Text match' and 'Equivalent queries' and that is too limiting.
    So decided to have nested materialized view, with first view having just joins(my_dim_mvw_joins), the second view having aggregations along Calendar dimension (my_dim_mvw_calendar) and third view having aggregations along the Location dimension(my_dim_mvw_location). Obviously I do not want the query I fire to know about materialized views and I fire it against the fact table. I see that for the fired query (Which needs aggregations along both Calendar and Location), is rewritten with just second materialized view but not the third. (Had set QUERY_REWRITE_INTEGRITY as TRUSTED) .
    Wanted to know whether there are limitations on Query Writes with nested materialized views? Thanks
    (Have given a simple testable example below. Pls ignore the values given in 'CALENDAR_IDs', 'PRODUCT_IDs' etc as they are the same for all the queries)
    -- Calendar hierarchy table
    CREATE TABLE CALENDAR_HIERARCHY_TREE
    (     "CALENDAR_ID" NUMBER(5,0) NOT NULL ENABLE,
    "HIERARCHY1_ID" NUMBER(5,0),
    "HIERARCHY2_ID" NUMBER(5,0),
    "HIERARCHY3_ID" NUMBER(5,0),
    "HIERARCHY4_ID" NUMBER(5,0),
    CONSTRAINT "CALENDAR_HIERARCHY_TREE_PK" PRIMARY KEY ("CALENDAR_ID")
    -- Location hierarchy table
    CREATE TABLE LOCATION_HIERARCHY_TREE
    (     "LOCATION_ID" NUMBER(3,0) NOT NULL ENABLE,
    "HIERARCHY1_ID" NUMBER(3,0),
    "HIERARCHY2_ID" NUMBER(3,0),
    "HIERARCHY3_ID" NUMBER(3,0),
    "HIERARCHY4_ID" NUMBER(3,0),
    CONSTRAINT "LOCATION_HIERARCHY_TREE_PK" PRIMARY KEY ("LOCATION_ID")
    -- Product hierarchy table
    CREATE TABLE PRODUCT_HIERARCHY_TREE
    (     "PRODUCT_ID" NUMBER(3,0) NOT NULL ENABLE,
         "HIERARCHY1_ID" NUMBER(3,0),
         "HIERARCHY2_ID" NUMBER(3,0),
         "HIERARCHY3_ID" NUMBER(3,0),
         "HIERARCHY4_ID" NUMBER(3,0),
         "HIERARCHY5_ID" NUMBER(3,0),
         "HIERARCHY6_ID" NUMBER(3,0),
         CONSTRAINT "PRODUCT_HIERARCHY_TREE_PK" PRIMARY KEY ("PRODUCT_ID")
    -- Fact table
    CREATE TABLE RETAILER_SALES_TBL
    (     "PRODUCT_ID" NUMBER,
    "PRODUCT_KEY" VARCHAR2(50 BYTE),
    "PLAN_ID" NUMBER,
    "PLAN_PERIOD_ID" NUMBER,
    "PERIOD_ID" NUMBER(5,0),
    "M1" NUMBER,
    "M2" NUMBER,
    "M3" NUMBER,
    "M4" NUMBER,
    "M5" NUMBER,
    "M6" NUMBER,
    "M7" NUMBER,
    "M8" NUMBER,
    "LOCATION_ID" NUMBER(3,0),
    "M9" NUMBER,
    CONSTRAINT "RETAILER_SALES_TBL_LOCATI_FK1" FOREIGN KEY ("LOCATION_ID")
    REFERENCES LOCATION_HIERARCHY_TREE ("LOCATION_ID") ENABLE,
    CONSTRAINT "RETAILER_SALES_TBL_PRODUC_FK1" FOREIGN KEY ("PRODUCT_ID")
    REFERENCES PRODUCT_HIERARCHY_TREE ("PRODUCT_ID") ENABLE,
    CONSTRAINT "RETAILER_SALES_TBL_CALEND_FK1" FOREIGN KEY ("PERIOD_ID")
    REFERENCES CALENDAR_HIERARCHY_TREE ("CALENDAR_ID") ENABLE
    -- Location dimension definition to promote query rewrite
    create DIMENSION LOCATION_DIM
    LEVEL CHAIN IS LOCATION_HIERARCHY_TREE.HIERARCHY1_ID
    LEVEL CONSUMER_SEGMENT IS LOCATION_HIERARCHY_TREE.HIERARCHY3_ID
    LEVEL STORE IS LOCATION_HIERARCHY_TREE.LOCATION_ID
    LEVEL TRADING_AREA IS LOCATION_HIERARCHY_TREE.HIERARCHY2_ID
    HIERARCHY PROD_ROLLUP (
    STORE CHILD OF
    CONSUMER_SEGMENT CHILD OF
    TRADING_AREA CHILD OF
    CHAIN
    -- Calendar dimension definition
    create DIMENSION CALENDAR_DIM
    LEVEL MONTH IS CALENDAR_HIERARCHY_TREE.HIERARCHY3_ID
    LEVEL QUARTER IS CALENDAR_HIERARCHY_TREE.HIERARCHY2_ID
    LEVEL WEEK IS CALENDAR_HIERARCHY_TREE.CALENDAR_ID
    LEVEL YEAR IS CALENDAR_HIERARCHY_TREE.HIERARCHY1_ID
    HIERARCHY CALENDAR_ROLLUP (
    WEEK CHILD OF
    MONTH CHILD OF
    QUARTER CHILD OF
    YEAR
    -- Materialized view with just joins needed for other views
    CREATE MATERIALIZED VIEW my_dim_mvw_joins build immediate refresh complete enable query rewrite as
    select product_id, lht.HIERARCHY1_ID, lht.HIERARCHY2_ID, lht.HIERARCHY3_ID, lht.location_id, cht.HIERARCHY1_ID year,
    cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week, m1, m3, m7, m9
    from retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
    WHERE RS.period_id = cht.CALENDAR_ID
    and RS.location_id = lht.location_id
    and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
    AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
    AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
    -- Materialized view which aggregate along calendar dimension
    CREATE MATERIALIZED VIEW my_dim_mvw_calendar build immediate refresh complete enable query rewrite as
    select product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID ,location_id, year, quarter, month, week,
    sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total,
    GROUPING_ID(product_id, location_id, year, quarter, month, week) dim_mvw_gid
    from my_dim_mvw_joins
    GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id,
    rollup (year, quarter, month, week);
    -- Materialized view which aggregate along Location dimension
    CREATE MATERIALIZED VIEW my_dim_mvw_location build immediate refresh complete enable query rewrite as
    select product_id, year, quarter, month, week, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id,
    sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1,
    GROUPING_ID(product_id, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id, year, quarter, month, week) dim_mvw_gid
    from my_dim_mvw_calendar
    GROUP BY product_id, year, quarter, month, week,
    rollup (HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id)
    -- SQL Query Fired (for simplicity have used SUM as aggregation operator for both, but they will be different)
    select product_id, year, HIERARCHY1_ID, HIERARCHY2_ID,
    sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1
    from
    select product_id, HIERARCHY1_ID , HIERARCHY2_ID , year,
    sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total
    from
    select product_id, lht.HIERARCHY1_ID , lht.HIERARCHY2_ID , lht.HIERARCHY3_ID ,lht.location_id, cht.HIERARCHY1_ID year, cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week,m1,m3,m7,m9
    from
    retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
    WHERE RS.period_id = cht.CALENDAR_ID
    and RS.location_id = lht.location_id
    and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
    AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
    AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
    GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id, year
    ) sales_time
    GROUP BY product_id, year,HIERARCHY1_ID, HIERARCHY2_ID
    This Query rewrites only with my_dim_mvw_calendar. (as saw in Query Plan and EXPLAIN_MVIEW). But we would like it to use my_dim_mvw_location as that has aggregations for both dimensions.

    blackhole001 wrote:
    Hi all,
    I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
    Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
    Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
    Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model.

Maybe you are looking for