Cartesian join on 2 dimension tables, with count aggregation?

Hi, I have 2 dimension tables, Students, and Subjects, and a fact table, Marks. (simplified)
the Students and Subjects dimension tables both have a 1-N relationship with Marks, so reporting works fine.
However, there are some students who does not have a score in a certain Subject, so when I generate the report of each Subject's scores by Student it'll be
Subject Students Marks
English A 89
......... C 70
......... D 60
Maths B 30
......... C 80
because Students and Subjects are joined by the Marks table
What I'd like to see is
Subject Students Marks
English A 89
......... B 0
......... C 70
......... D 60
Maths A 0
......... B 30
......... C 80
......... D 0
The joins between the dimension and fact tables are all set to "Left-outer join" (where "left" is the dimension table)
I thought I needed a cartesian/cross join on Subjects and Students, using the dummy table technique here: http://gerardnico.com/wiki/dat/obiee/densification_repository#the_cross_join_between_the_dimensions
But it didn't work, not to mention that I have a feeling that this doesn't really apply to 10g or my problem.
Can someone point me in the right direction on this? Thanks!
Above problem solved, but I also need a column of "Count of students who scored 50 or less" which includes the students who did not have any scores. Adding the dummy column to my report breaks the aggregation in my report, while removing the column will take me back to square one.
How do I generate a report that does aggregation that takes into account the students with no scores?
Edited by: lum on 28-Mar-2012 20:13

Here's what I did:
I created the physical table with 1 column, and did a complex join with expression "1=1" on the 2 tables that my actual fact table was directly joined to (and none of the indirect joins). I'm using 11g, so to do complex joins I had to use Manage->Joins
Then I added the dummy column to my Marks fact table in the BMM layer by just dragging it and set the aggregation rule. And then to the presentation layer too.
After updating the repository onto the server, the table behaviour is still the same as before, and the dummy column didn't do anything and displayed a blank value.
Could it be because of my other joins that make this dummy join not work? I don't even know if this 1=1 complex join work in 11g....!
Has anyone tried this join technique in 11g? Thanks!
PS: My dimension table and fact tables are actually logical tables that join several tables at the logical table source layer. My dummy fact table just joins the most detailed layer of the physical dimension tables.

Similar Messages

  • Best Practice loading Dimension Table with Surrogate Keys for Levels

    Hi Experts,
    how would you load an Oracle dimension table with a hierarchy of at least 5 levels with surrogate keys in each level and a unique dimension key for the dimension table.
    With OWB it is an integrated feature to use surrogate keys in every level of a hierarchy. You don't have to care about
    the parent child relation. The load process of the mapping generates the right keys and cares about the relation between the parent and child inside the dimension key.
    I tried to use one interface per Level and created a surrogate key with a native Oracle sequence.
    After that I put all the interfaces in to one big Interface with a union data set per level and added look ups for the right parent child relation.
    I think it is a bit too complicated making the interface like that.
    I will be more than happy for any suggestions? Thank you in advance!
    negib
    Edited by: nmarhoul on Jun 14, 2012 2:26 AM

    Hi,
    I do like the level keys feature of OWB - It makes aggregate tables very easy to implement if your sticking with a star schema.
    Sadly there is nothing off the shelf with the built in knowledge modules with ODI , It doesnt support creating dimension objects in the database by default but there is nothing stopping you coding up your own knowledge module (use flex fields maybe on the datastore to tag column attributes as needed)
    Your approach is what I would have done, possibly use a view (if you dont mind having it external to ODI) to make the interface simpler.

  • Cartesian of data from two tables with no matching columns

    Hello,
    I was wondering – what’s the best way to create a Cartesian of data from two tables with no matching columns in such a way, so that there will be only a single SQL query generated?
    I am thinking about something like:
    for $COUNTRY in ns0: COUNTRY ()
    for $PROD in ns1:PROD()
    return <Results>
         <COUNTRY> {fn:data($COUNTRY/COUNTRY_NAME)} </COUNTRY>
         <PROD> {fn:data($PROD/PROD_NAME)} </PROD>
    </Results>
    And the expected result is combination of all COUNTRY_NAMEs with all PROD_NAMEs.
    What I’ve noticed when checking query plan is that DSP will execute two queries to have the results – one for COUNTRY_NAME and another one for PROD_NAME. Which in general results in not the best performance ;-)
    What I’ve noticed also is that when I add something like:
    where COUNTRY_NAME != PROD_NAME
    everything is ok and there is only one query created (it's red in the Query plan, but still it's ok from my pov). Still it looks to me more like a workaround, not a real best approach. I may be wrong though...
    So the question is – what’s the suggested approach for such queries?
    Thanks,
    Leszek
    Edited by xnts at 11/19/2007 10:54 AM

    Which in general results in not the best performanceI disagree. Only for two tables with very few rows, would a single sql statement give better performance.
    Suppose there are 10,000 rows in each table - the cross-product will result in 100 million rows. Sounds like a bad idea. For this reason, DSP will not push a cross-product to a database. It will get the rows from each table in separate sql statements (retrieving only 20,000 rows) and then produce the cross-product itself.
    If you want to execute sql with cross-products, you can create a sql-statement based dataservice. I recommend against doing so.

  • Multiple Joins from one Dimension Table to single Fact table

    Hi all,
    I have a single fact table with attributes as such:
    Action_ID
    Action_Type
    Date_Started
    Date_Completed
    and a Time Dimension to connect to the fact table. Currently the 2 Date columns in my fact table are in the format of 20090101 (which is the same as my key in the time dimension), if it means anything. I've tried to create multiple joins but have been getting error messages. What is the easiest way to link the time dimension with the two date columns in my fact table? Thanks.

    hi..
    it seems to be, you need to use between operator to join time dimension with fact (i.e. Non-equi join)
    If it's then you should create complex join in physical layer by connecting dimension with your fact.
    select columns and operators in such a way that it resembles something like the below.
    timeDimension.timeKey BETWEEN FactTable.Date_Started AND FactTable.Date_Completed

  • Join rows from 2 tables with non-matching numeric intervals

    Hi,
    Could you please help me with the following:
    I have 2 tables - [Coal_Samples] and [Coal Type] Which I have pasted below. I want to create a single result set that matches as closley as possible [Coal Type].Coal_Type to the interval between [Coal_Samples].mfrom and [Coal_Samples].mto. I would have
    [Coal_Samples] as the primary table using a left outer join.
    The problem is that the intervals [Coal_Samples].mfrom do not match [Coal Type].mfrom and [Coal_Samples].mto does not match [Coal Type].mto. I want to match the [Coal_Samples] intervals ([Coal_Samples].mfrom-[Coal_Samples].mto) as closely as possible to
    the [Coal_Type].Coal_Type field.
    I have been able to acheive this in excel using a VLOOKUP statement - but I want to know how to do this with and SQL Script without duplicating the rows based in [Coal_Samples].mfrom-[Coal_Samples].mto interval. 
    COAL SAMPLES TABLE
    ID
    mFrom
    mTo
    SAMPLE NUMBER
    AD261
    57
    57.5
    SAMPLE_001
    AD261
    57.5
    58
    SAMPLE_002
    AD261
    58
    59
    SAMPLE_003
    AD261
    59
    60
    SAMPLE_004
    AD261
    60
    61
    SAMPLE_005
    AD261
    61
    62
    SAMPLE_006
    AD261
    62
    63
    SAMPLE_007
    AD261
    63
    64
    SAMPLE_008
    AD261
    64
    65
    SAMPLE_009
    AD261
    65
    66
    SAMPLE_010
    AD261
    66
    67
    SAMPLE_011
    AD261
    67
    68
    SAMPLE_012
    AD261
    68
    69
    SAMPLE_013
    AD261
    69
    70
    SAMPLE_014
    AD261
    70
    71
    SAMPLE_015
    AD261
    71
    72
    SAMPLE_016
    AD261
    72
    73
    SAMPLE_017
    AD261
    73
    74
    SAMPLE_018
    AD261
    74
    75
    SAMPLE_019
    AD261
    75
    76
    SAMPLE_020
    AD261
    76
    77
    SAMPLE_021
    AD261
    77
    78
    SAMPLE_022
    AD261
    78
    79
    SAMPLE_023
    COAL   TYPE TABLE
    ID
    Type_mFrom
    Type__mTo
    COAL TYPE
    AD261
    57
    68.6
    BROWN COAL
    AD261
    68.6
    75
    GREY COAL
    AD261
    75
    78.2
    BLACK COAL
    AD261
    78.2
    79.2
    BLACK COAL
    Example   RESULT SET
    ID
    mFrom
    mTo
    DOMINANT_COAL TYPE
    AD261
    57
    57.5
    BROWN COAL
    AD261
    57.5
    58
    BROWN COAL
    AD261
    58
    59
    BROWN COAL
    AD261
    59
    60
    BROWN COAL
    AD261
    60
    61
    BROWN COAL
    AD261
    61
    62
    BROWN COAL
    AD261
    62
    63
    BROWN COAL
    AD261
    63
    64
    BROWN COAL
    AD261
    64
    65
    BROWN COAL
    AD261
    65
    66
    BROWN COAL
    AD261
    66
    67
    BROWN COAL
    AD261
    67
    68
    BROWN COAL
    AD261
    68
    69
    BROWN COAL
    AD261
    69
    70
    GREY COAL
    AD261
    70
    71
    GREY COAL
    AD261
    71
    72
    GREY COAL
    AD261
    72
    73
    GREY COAL
    AD261
    73
    74
    GREY COAL
    AD261
    74
    75
    GREY COAL
    AD261
    75
    76
    BLACK COAL
    AD261
    75
    76
    BLACK COAL
    AD261
    76
    77
    BLACK COAL
    AD261
    77
    78
    BLACK COAL
    AD261
    78
    79
    BLACK COAL
    Can you please help with the logic of this query?
    Thanks very much.

    Well, here is the beginning of the solution:
    ;with cte as (select S.*, T.[Coal Type] as [Dominant_Coal],
    case when 
    T.m_from between S.m_from and S.m_to
    AND T.m_to between S.m_from and S.m_to then 0
    when T.m_from between S.m_from and S.m_to then t.m_from - S.m_from
    else S.m_to - T.m_to end as [Diff]
    from Coal_Samples S LEFT JOIN Coal_Type T
    ON T.m_from between S.m_from and S.m_to
    OR T.m_to between S.m_from and S.m_to),
    cte1 as (select *, row_number() over (partition by cte.ID order by Diff) as Rn
    from cte)
    select * from cte1 where Rn = 1 -- attempt to get best match
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to make join bsis,bkpf,bseg table with zdbb and zobb table for data retrieval

    HI,
    I have an abap  development requirement in which i have to retrieve data fields from different table, like bsis ,bkpf, bsip, bsas, pyar, lfa1,skat,etc.
    I have retrieved data from bsis and bkpf and bseg by finding  common field like "belnr, budat bukrs gjahr" to through FOR ALL ENTERIES, but when I going to get relevant data from zdbb table which is  orginated bank details table ,in this I haven't find any common field on the basis of  which i retrieve relevant data,
    please guide me in in this regard as I have already searched web for this solution but haven't find a satisfactory answer.
    Thanks.

    Hi  Ruks Pathirage
    THANKS FOR YOUR REPLY.
    I have checked both of the tables i.e lfbk and zdbb but haven't find any common field, coz data element is different,
    please see the snap shots.
    lfbk table:
    and zdbb,
    In my understading there is no com'n field , though bank key is common field in both table but both have different data element.
    thanks

  • Dimension table is associated with N number of fact tables

    Hi Expert's,
    In case of star schema one fact table is associated with N dimension tables , is it possible to join one dimension table with N number of fact tables...please let my know the your suggestion...
    Thank's
    Harish

    is it possible to join one dimension table with N number of fact tablesYes you can join one dimension table to many fact tables.
    Thanks,
    Vino

  • Joining Multiple facts to the multiple Dimension tables

    Hi All,
    We have multiple fact tables which are Joined to common Dimension tables. We join them in physical layer and maintain Left outer join in the BMM. I do not get any consistency errors. But when I run report I get error.
    "could not find level detailed enough for group by clause" any suggestion on the same.
    The join Strucutre is as follows.
    Facts - F1, F2, F3
    Dim - D1, D2, D3
    F1 --> D1, D2, D3
    F2--> D1, D2,
    F3--> D1, D2, D3
    We cannot combine F2, F3 into F1 using multiple Logical Table Source.
    What is the best way to achieve the above mentioned functionality.
    Please advice.
    Regards,
    Narendra Shetty.

    Check this
    OBI Error While Running Query
    Update us back with solution, if helps pls mark
    Edited by: Srini VEERAVALLI on Dec 20, 2012 7:13 AM

  • Populating Fact and Dimension Tables

    Hi there,
    New to OLAP. I've defined my schema design and would like to start population my dimension tables along with the foreign key references in my fact tables to my dimension tables.
    Before I begin writing a bunch of PL/SQL scripts to do this. I am wondering if any tools exist to help expedite this type of process.
    As a start I will be linking my fact table to two dimensions. One being a standard date dimension, the other being a user dimension consisting of hours and minutes. Any examples, links would be greatly appreciated.
    Thanks!

    Hi Chandra, it would be useful if you read a little bit about BI before start working with a BI tool.
    Anyway, I'll try to help you.
    A dimension is a structure that will be join to the fact table to so that users can analyze data from different point of views and levels. The fact table will most probably (not always) have data at the lowest possible level. So, let's suppose you have SALES data for different cities in a country (USA). Your fact table will be:
    CITY --- SalesValue
    Miami --- 100
    NYC --- 145
    Los Angeles --- 135 (because Arnold is not managing the State very well ;-) )
    You will then can have a Dimension table with the "Country" structure. This is, a table containing the different cities along with their states, counties, and finally the country. So your dimension table would look like:
    NATION --- STATE --- COUNTY --- CITY
    USA --- Florida --- Miami --- Miami
    USA --- NY ---- NY --- NYC
    USA --- Los Angeles --- LA --- Los Angeles
    This dimension will allow you to aggregate the data at dffirent lavels. This is, the user will not only be able to see data at the lowest level, but also at the County, State and Country level.
    You will join your fact table (field CITY) with your dimension table (field CITY). The tool will then help you with the aggregation of the values.
    Ihope this helps.
    J.-

  • Fact and Dimension tables

    Hi all,
    Please let me know the relation between the fact and dimension table(s).
    regards
    chandra kanth.

    Hi Chandra, it would be useful if you read a little bit about BI before start working with a BI tool.
    Anyway, I'll try to help you.
    A dimension is a structure that will be join to the fact table to so that users can analyze data from different point of views and levels. The fact table will most probably (not always) have data at the lowest possible level. So, let's suppose you have SALES data for different cities in a country (USA). Your fact table will be:
    CITY --- SalesValue
    Miami --- 100
    NYC --- 145
    Los Angeles --- 135 (because Arnold is not managing the State very well ;-) )
    You will then can have a Dimension table with the "Country" structure. This is, a table containing the different cities along with their states, counties, and finally the country. So your dimension table would look like:
    NATION --- STATE --- COUNTY --- CITY
    USA --- Florida --- Miami --- Miami
    USA --- NY ---- NY --- NYC
    USA --- Los Angeles --- LA --- Los Angeles
    This dimension will allow you to aggregate the data at dffirent lavels. This is, the user will not only be able to see data at the lowest level, but also at the County, State and Country level.
    You will join your fact table (field CITY) with your dimension table (field CITY). The tool will then help you with the aggregation of the values.
    Ihope this helps.
    J.-

  • Merge cartesian join in query plan

    Hi All
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    W are using many GTT's in our code, the query plan have Merge Cartesain join showing cardinality as '1' which is incorrect, as GTT tables have many rows. Due to this query is taking ages to execute.
    I am trying to sue dynamic sampling, but it doesn't seem to work.
    please help on this.

    user8650395 wrote:
    Hi All
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    W are using many GTT's in our code, the query plan have Merge Cartesain join showing cardinality as '1' which is incorrect, as GTT tables have many rows. Due to this query is taking ages to execute.
    I am trying to sue dynamic sampling, but it doesn't seem to work.
    please help on this.Interesting.
    There was a a thread a day or two ago about when dynamic sampling does not work. You can search OTN for it if you like. Also check the docs to make sure that dynamic sampling works with GTTS
    One problem with GTTS is getting accurate statistics. Have you considered using DBMS_STATISTICS to set the statistics on the table to adjust the cardinality?
    Your cardinality of 1 sounds incorrect. In theory a cartesian join against one row should be painelss; unfortunately your cardinality figure seems to be off! Sometimes in cases like yours the cost-based optimizer will choose a Cartesian join even when the table joins are properly specified.

  • How to handle Fact tables with different granularity in OBIEE 11g RPD

    Hello Everyone,
    I have got stuck here and need your help.
    I have two fact tables (Say F1 and F2... F1 is containing data at month-level and F2 is containing data at day level) and one Date DIMENSION TABLE. Date_Code is the PK of Date dimension table.I need to use time-series functions also.
    Can anyone tell me how to model this requirement in the RPD.
    Can we use a single dimension table(Here Date dimension table) with two fact table of different grainularity? What would be the best way to implement this requirement?
    Thanks in advance :)

    Hi Veeravalli,
    Thanks for your reply :)
    Let me explain the problem in more detail. I have one Date dimension(Date_Code,Month_Code,Quarter_Code,Half_Year_Code,Year_Code). Here Date_Code is the PK.
    In F1---->Date (Using Month_Code key)
    F2-------->Date (Using Date_Code Key)
    Level based hierarchy is there starting from Year to Date.Each level has PK defined and chronological key selected.
    F1 has level set to Month and F2 has level set to Day.
    Now if i am using ago() function on measure of F2 (having day level data) then it's working fine but if i am using ago() function on measure of F1...I am getting an error at Presentation service: Date_code must be projected for time-series functions.
    So the whole issue is with time-series functions. As per my research...I think for time series the tables in the physical model containing the time dimension cannot join to other data sources, except at the most detailed level but here i am joining with F1(using Month_Code which is not the most detailed level).
    So kindly let me know how to achieve this in rpd?

  • Loading Data into Table with Complex Transformations

    Hello Guys
    I am trying to load data into one of the Dimension table and it has quite a few Transformations and i created 6 temp tables
    1. It has 7 Columns , Gets 935 rows based on where condition
    2. It has 10 Columns , Gets 935 rows with but it has nulls in it i.e for column 1 there are 500 fields and columns 2 there are 300 etc ...
    3 , 4 , 5 , 6 all the same as the 2 table
    and at the end when i am trying to join all the temp tables with the Product_id into the target , which is in each temp table ...
    I am Getting Error Saying Not Obeying Primary key Constraints i.e unique values are not been inserting into the Product_id Column of Target Table and the Job is running for Hours
    and the main Problem comes at , some of the Columns have the same Product_id
    Please help me
    I have been Trying for 1 week and i am in Full pressure
    Thanks
    Sriks
    Edited by: Sriks on Oct 16, 2008 6:43 PM

    Hi,
    If you are creating a warehouse and product_key is ur PK then it should come only once and so u might have to think ur logic in getting the data. To get over the isue u can disable the constraint and load with out the cosntraint, but i would have u look at the logic and make sure u have only 1 product_key in the table.
    Regards
    Bharath

  • Urgent-Issue in the Dimension tables

    Hi Experts,
    Question1:
    I have a flat file load to a cube.this flat file has 1.5 mil records.One of the dimension created has a 2 dates(original date & current date) assigned.
    When i look at dimension table for # entries is 30million.And when i look at the table i see the sids as 0,0 ( for 2 dates) and dim id's being creted.
    When i did a search on the dimension table with current date & original date as not equal to 0.I see only 76,000 records.
    Question 2:
    we have an ODS which loads to the cube.In the process chain we have program that deletes the data in ods which does not match some conditions and then loads it tot he cube.
    My question is,since we are not deleting contents from the cube and reloading it from the ODS(Full update).Will i not be seeing same records coming in with Full update which get agrregated in the cube.
    Ex: i have a record in ODS.
    A   X  Z  100  1000
    After full update to the cube,the cube would have
    A   X  Z  100  1000
    When i run the process chain and data is dleeted from ODS on some condition and i still have hte same record in ODS and when this loads into cube wont this be aggregated with the previous record.
    A  X   Z  200  2000
    Would appreciate,if anyone could explain if i am missing anything.

    Hello,
    If you can't see the SID means you have not loaded the master data, that why there is no reference to the SID table and the values are 0.
    InfoCube by default will have aggregated values, when there are duplicate records on the Keyfigures will be aggregated.
    For example I have a Material Dimension and Customer Dimension
    In the fact table,  it will be like this
    DIM1     DIM2    KF1   KF2
    Mat001  Cust1  100    10
    Mat001  Cust2  200    5
    for this there will be 1 entry in Material DIM table for Mat001 and 2 entries for Customer DIM table for Customer Cust1 and Cust2.
    Material  Dimension
    DIM ID    SID
    1             Mat001  (Here it will be SID from Material Master)
    Customer Dimension
    1             Cust1  (Here it will be SID from Customer Master)
    2             Cust2  (Here it will be SID from Customer Master)
    Note : DIM ID is the combination of one or more SID in the dimension table.
    So the exact fact table will look like
    MATDIM    CUSDIM       AMT      QTY
    1               1                  100        10
    1               2                  200        5
    If you load the data again with same characteristics values then the key figure will be aggregated
    Example if you load
    Mat001 Cust2 25 5
    then the fact table will not have a new entry instead the it will aggregates and looks like (bolded one)
    MATDIM    CUSDIM       AMT      QTY
    1               1                  100        10
    1               2                  220        10
    Hope its clear
    thanks
    Chandran

  • Change entris on dimension table

    Hi All,
    We have two entries in DIM table one for Fixed currency info object in the cube like blow.
    1. DIMID   SID_0CURRENCY SID_0SALES_UNIT
        0          1000000044         2
    DIMID is zero beacuse we have created Info Object with fixed currency.
    Now we have to open this filed for all the currency but system not allowing to change the Info Object beacuse data in the cube and we have almost 2 Billion record in the cubes.
    So we are thinking to do the changes like below.
    We have another entries in the table for not fixed currency Info Object
    2.DIMID ;  SID_0CURRENCY SID_0SALES_UNIT
       2         1000000045         3
    SO now we are planning to overwrite record 1 with record 2. so my new record 1 look like below.
    1. DIMID   SID_0CURRENCY SID_0SALES_UNIT
       02         1000000045         3
    Please suggest me can we change the DIM table.
    Saleem.

    Hi Saleem
    Dont manupulate the dimension table values manaually,it may leads to inconsistency(after doing manual change RSRV sure will through error).If you do so the connection of Dimension table with Fact and SID will get distrub,same can be rectified by RSRV,repair objects.Not sure how for it will recreate the connections..
    Still if you want to take risk...dont delete the Fact table data...via SE38 (prog name DB_DROP TABLES*...Not sure about the program name,better search)  delete the Dimension table values(if its not permissible means same can be achieved by ABAP debugging),delete master table and freshly populate the master data table.
    Use SLG1 for more Txn data analysis.
    Thanks
    TG

Maybe you are looking for

  • I can't get my external hard drive to read

    Since I upgraded from snow leopard (or maybe even the one before that) to Lion it hasnt worked.  It still lights up and sounds like its running but it wont show up at all. All of my USB ports work but it wont read at all

  • Default for baseline date  in Payment terms

    Hi All, Can anyone please explain me the options in OBB8 default for base line date 1. No Default 2. Posting Date 3. Document date 4. Entry Date while creating payment terms with examples. It's very very very Urgent!!!!!!!!!!!! Thanks in advance. Bop

  • Making a form portlet reusable by allowing a parameter to be passed to it

    I have a form that allows maintenance on records. I need to filter the records that a user can maintain, (and insert) based on a column value. I can accomplish this by setting the default value for the (hidden) column. When I query and maintain the r

  • Creative Media Source Player clipped tracks problem

    <span class="j2">I <span class="j2">am <span class="j2">using <span class="j2">the <span class="j2">Creative <span class="j2">Media <span class="j2">source <span class="j2">player (<span class="j2">Version <span class="j4">5.0.38 <span class="j2">wit

  • New Field In Database table

    Dear Gurus, If some standard SAP field is added in a standard database table as a part of upgrade. Is there a way we can find out when that field is added to the database table. Regards, Subhajit