Fact join Fact in DAX

hi All,
I have a question about DAX for join itself, the scenario is:
1. get last quarter customer with "A" status from Fact table
2. based on the customer list get from #1 to join this quarter customer with "AB"status  from the same fact table
3. distinct count #2 customer 
===================
sample T-SQL query as below,
===================
select count(distinct a.CUSTOMER_ID)
FROM [Fact Table] a
inner join ( 
SELECT distinct [CUSTOMER_ID] as [CUSTOMER_ID]
FROM [Fact Table]
where Date between '2014-01-01' and '2014-03-01'
and [Status]='A'
  ) b on a.CUSTOMER_ID=b.CUSTOMER_ID
 where Date between '2014-04-01' and '2014-06-01'
 and [Status]='AB'
kindly advise if any solutions, thanks in advanced.
Jackie

Look at the "Transition Matrix" in Tabular model in "The Many-to-Many Revolution" whitepaper:
http://www.sqlbi.com/articles/many2many/
Marco Russo (Blog,
Twitter,
LinkedIn) - sqlbi.com:
Articles, Videos,
Tools, Consultancy,
Training
Format with DAX Formatter and design with
DAX Patterns. Learn
Power Pivot and SSAS Tabular.

Similar Messages

  • Advice needed: join fact to time dimension with between clause

    Hi All,
    I've got 1 dimension and two fact tables. The 1 dimension could serve as a time dimension.(not specifically marked as this is a time dimension)
    My Tables look like this (simplified)
    Dim1:
    date_pk (unique identifier)
    date
    month
    year
    fact1:
    iid_date (foreign key to date_pk)
    fact1_amount
    Fact2:
    begin_date
    end_date
    fact2_amount
    In the physical layer i have a complex join between fact 1 and dim1 (date_pk = idd_date) and a complex join between fact2 and dim1 (dim1.date between fact2.begin_date and fact2.end_date and dim1.date <= CURRENT_DATE). In the business model i have complex joins between fact1 and dim1 and a complex join between fact2 and dim1 without further specification.
    What I would like to achieve in Answers is that I select a Year and a Month from dim1 and add fact1_amount and fact2_amount to the same report and that the report shows both amounts. I would like some advice on how to set this up. Further more how to add a drill from year to month to date and what should I do when I'm willing to add more facts joined to the same Dim1
    Any Advice is greatly appreciated
    Gilles

    Hello MMA1709,
    You're right, this setup works!
    But...
    When you add an hierarchy and mark it as a time dimension it doesn't work anymore. It gives the following error in the consistency checker:
    [38086] Physical table Dim1 in the time dimenison table source Dim1 is part of a complex join condition
    And that means you cannot use any timebased calculations (AGO and TODATE). When I just create an hierarchy and do not mark it as a time dimension the hierarchy works well.
    Any suggestions?

  • Join fact table with higher dimension level

    how do i join fact tables with higher dimension levels with discoverer?
    fact with detail at level C
    measure X
    dimension with
    D->C->B->A
    E->C
    level
    A B C
    1------1------1
    2------2------1
    3------2------1
    join between fact X and dimension level C
    X=3*C because of sum(X) in discoverer and 3xC in dimension
    is there a way to get correct values for X without creating a dimension like
    D->C
    E->

    another way of asking this is whether you can create a summary table in Discoverer at a higher level than a dimension's fundamental grain. In other words - the summary examples in the documentation all describe leaving out one or more of your dimensions... they are either left in or completely taken out. But, some of the most effective summarization occurs when you summarize daily data to a monthly level. Assuming that I have a sales table (at a daily level, and a key value sales_date), and a table date_dim (primary key sales_date), I would like to create a summary sales_month_summary where the sales are grouped on month_year (which is a field in the sales_date table).
    How is this done? I suspect that we can't use the date_dim table with the summary (due to the problems noted by the poster above). Do we have to create another table "month_dim"? Do we have to fold all of the desired date attributes (month, quarter, year) into the summary? Obviously we'd like to re-use all of the pertinent already existing date items (quarter, month, year, etc.), not recreate them over again, which would result in essentially two sets of items in the EUL. [One used for this month summary, and another used for the detail.]
    I searched the forum - someone asked this same question back in 2000 - there was no answer provided.
    The only other thought I have is to "snowflake" the date_dim into two tables and two folders, one at a date level, another at the month level. Then the detail tables can connect to date_dim (which is linked to month_dim), while the summary data can connect directly to month_dim.

  • Drill across (joining facts) using Discoverer

    Hi,
    I've read a few books and article on DW talking about drilling across. It seems a good idea to build multiple star schemas with "conforming" dimensions and then join fact tables (drill across) when needed.
    I have tried this solution, and afer a few tests, got to the conclusion that it is preferable to UNION ALL the related facts using a view or a custom folder. Of course this solution is less flexible because we need to find all the required combinations of facts.
    Any comments?

    OK,
    I have 3 dimensions : D1, D2, D3 and 2 facts : F1, F2.
    Dimensions D1, D2 are related to fact F1.
    Dimensions D1, D2, D2 are related to fact F2.
    I want to query on fact F2 based on values of dimensions D1 and D2, and then join F1 to get corresponding measures.
    When running the query I get the following error:
    Invalid combination of joins using different join keys - query cannot be resolved.
    I use Oracle Discoverer 9.0.2.53.12.
    What would be the best way to work around this restriction?

  • Join fact with another fact like a dimension

    Does it work if I join fact table with another fact table as a dimention(created the dummy hierarchy and add the sum() to the measure existed in the table)?
    If I pick the measure value in the fact table(which is configured like a dim), I will get the correct number? Or multiplied number?
    If there is any good way of work around please let me know
    Thanks
    Edited by: user12077461 on Jun 29, 2011 7:39 PM

    Hi,
    You can create an Alias Table in the Physical Layer for the Fact table which you want to use as a Dimension Table. And start using the Dimension Table. And if you want any measure values to be used from the Fact, then you can extract that too.
    This should simplify your work too.
    Regards
    MuRam

  • Can we Join Fact to Fact obiee11g

    Can we Join Fact to Fact obiee11g?
    Regards
    kumar

    - From a physical data model point of view, yes.
    - From a logical data model point of view, not.
    To resume, you can but one of the fact must be in the business model layer of the repository designed as a dimension of the other fact table.
    Cheers
    Nico

  • Can we join fact to fact?

    i am new to obiee i found this question in some bi sites.
    ” If you have 3 facts and 4 dimension and you need to join would you recommend joining fact with fact? If no than what is the option? Why you won’t join fact to fact?
    i found the answer like this
    o In the BMM layer, create one logical table (fact) and add the 3 fact table as logical table source.
    but i didn't find the anser for Why you won’t join fact to fact?
    Pleae guys help me.......................
    Thans in advance.
    Rani

    You can join any two table which has some relationship but ideally you don't join Fact to Fact because its not a good practice and degrades performance..
    Get some guidance from here http://siebel.ittoolbox.com/documents/how-to-join-two-fact-tables-14090

  • RPD: Wrong Fact join when utilizing Level Based Measures (TOTAL Level)

    I have 2 Facts and 3 Dimensions (Customer, Customer Emails, Time) being used in the RPD. The Dimensions are all set with TOTAL and DETAIL hierarchies.
    Physical Layer:
    Fact 1 joined to all 3 Dimensions
    Fact 2 joined to all 3 Dimensions
    Business Layer:
    Fact 1 joined to all 3 Dimensions and Content Level set to DETAIL for all 3 Dimensions
    Fact 2 joined to all 3 Dimensions and Content Level set to DETAIL for all 3 Dimensions
    Metrics:
    Fact 1 Metric: SUM set to TOTAL Level for Customer Emails Dimension
    Fact 2 Metric: SUM set to TOTAL Level for Customer Emails Dimension
    Issue:
    I run a query pulling the metric from Fact 1 along with Dimension columns Email Address and Customer Name (2 Dimension Tables).
    2 Physical queries are generated one against Fact 1 to get the Metric total by Customer. The 2nd query to get the Customer and Email Address that hits the Fact 2 table.
    Expectation:
    I would expect both queries from above to hit the SAME fact table (Fact 1). I understand the 2nd query would NOT contain the metric (Due to it set to TOTAL), but a relationship exists between the Fact 1 table and the Email Dimension, since the metric is pulled from this table I'd expect the Dimension value to be pulled from this table as well.
    I look forward to any thoughts.

    Merging Customer and Customer Email will not work as a Customer can have multiple Email Addresses and changes the grain of that Dimension (Customer Level).
    Implicit fact would make no sense here, since each Fact has different sets of data.
    The basic issue here is that we have a Customer Email table that is NOT at the grain of the Fact or even the Customer Dimension. I would have loved to snowflake off the Customer Email from the Customer Dim but then the metrics get inflated when returned and total on.
    Hence we built the Email dimensions to join off the Fact and set all the metrics in each Fact (That joins to Customer) to TOTAL. So the metrics do not get inflated, the metrics repeat (Customer request) for each email per Customer.
    I hope that clarifies.

  • Fact joins in Physical ayer

    Hello All,
    I recently joined in a project, I was going through the RPD and I can see there are Fact to Fact joins in Physical layer..however there are no Fact joins in BMM layer.
    I'm trying to understand why these joins are created and how it will impact in BI query's. Thanks...

    It is Fact to Fact Extension they have joined i guess.
    http://satyaobieesolutions.blogspot.com/2012/07/implementing-multiple-fact-tables-in.html
    Mark if helps.

  • Fact to Fact Relationship urgent!!!!!!!

    Let us suppose there are 2 dimensions and 2 facts and every dimension is joined with every fact and there is no relation between two facts while selecting columns from both the facts with any dimension column its involving only one fact, we found one solution which is combined sql (union).
    can we have any other solution?
    Thanks in advance

    I hope I got your question.
    If you have 2 unrelated facts joined to a common dimension, and if you drag the dimension value and the measures from your fact tables, the data should show up as expected.
    For e.g. we have an orders received and an orders fulfilled fact tables that are unrelated, that we can see by day (the common dimension) in a single query without any union. Of course, your measures will need to be aggregated for your fact tables to return a single row for each dimension value, otherwise it would make no sense.
    HTH,
    Nilanshu.

  • Incorrectly defined logical table source (for fact table Facts) does not

    Hi,
    I have two Dimensions A and B. A is joined to B by a foreign Key.
    The report works if I pull B. Column1, A.Column2.
    The report is throwing an error if i try to change the order of the columns like this. A.Column2, B. Column1.
    error : Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    File: odbcstatementimpl.cpp, Line: 186
    State: S1000. Code: 10058. [NQODBC] [SQL_STATE: S1000] [nQSError: 10058] A general error has occurred. [nQSError: 15018] Incorrectly defined logical table source (for fact table Facts) does not contain mapping for B.Column1
    I am not sure where it is going wrong.
    Thanks
    jagadeesh
    Edited by: Jagadeesh Kasu on Jun 16, 2009 4:22 PM

    did you make joins in LTS or on the physical table.
    try to make join in LTS if they are not there.

  • IMPLICIT FACT & FACTLESS FACT

    Hello Gurus
    Can anybody please explain what is implicit fact and for what is it used for .
    And also
    Can anybody please explain Fact Less Fact and for what it is used for .

    follow this,
    1. open administration tool
    2. go to help
    3. click on Search tab
    4. type Implicit Fact
    5. only one topic you'll findin the results.. plz read it and let me know your doubts on that..
    coming to your next question...
    Factless Factohhh, got these links after googling..
    http://www.geekinterview.com/question_details/31538
    http://dylanwan.wordpress.com/bi-and-olap-glossary/factless-fact-table/
    http://www.allinterview.com/showanswers/36017.html

  • Fact - dimension and Fact Join

    Hi ,
    I have a issue in OBIEE 11g here ,
    I am trying to query two columns from 2 different fact tables F1 and F2
    the join between these tables is F1 - D - F2 , where D is the confirmed dimension.
    so when i am querying for
    f1.c1 , d.c1 , f2.c1 , its throwing me up with error
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 14020] None of the fact tables are compatible with the query request
    Can you please help me with this issue , am i doing the correct join ??, can we query two columns from two diff fact tables?
    Thanks in advance.

    Hi All,
    Thanks for your responses , I have tried creating hierarchy dimension and assgned levels to the fact sources but i still see the error
    and
    Combining 2 facts will resolve the issue but its not the case here as each fact table has about 25 dimensions connected to it , but there are only 2 confirmed dimensions between both facts and the problem here is user wants to see both the fact tables in the same subject area
    I have been trying but unable to get the solution.
    Can you guys please suggested any other way of achiving this task
    Thanks a lot

  • Fact to Fact join in Obiee

    Hi
    I am new in OBIEE, I have an scenario where in we need to join two fact tables and the condition is F1.date is between F2.valid from date & F2.valid To date
    I have tried using confirm dimension. Is it possible to map such scenario in OBIEE 11g
    Thanks
    Sameer

    Hi Venkat,
    I am coming from the basics of a star schema here, so hope it helps
    What is a fact?
    A fact is something that has all measures which can be aggregated (Units, Dollars, # of Orders) etc with keys to different dimensions.
    What is a dimension?
    It is the context with which we understand/record/retrieve the measures in the fact. We understand "# of Orders" for a product/By a customer etc.
    So joining a dimension and a fact helps to answer the Who/What/When kind of business questions. Ex : Who bought these products? What was the product type? When these products were sold kind of...
    Now just imagine tying up fact to another fact. With this kind of model, you can never answer any business question.
    I have never tried joining a fact with another fact in OBI (But do not think it will allow it though :) )
    Hope I am clear.
    Thank you,
    Dhar

  • 2 Dimensions and a Fact - Join Paths

    I have a scenario and I have been racking my brains out as to if what I am looking for could be set up. I have two dimenisions - Region and System - each System belongs to a Region. So the System Dimenison contains a Region_Key.
    I have a Fact table that contains both the Region_Key and the System_Key allowing each dimension above to be joined directly to the Fact table.
    Is there any way of creating a model where I could set it up where if someone pulls a column from just the System and Region it only pulls from these two tables (The join doesn't go through the Fact Table). And when a metric is pulled that it uses the direct joins to the Fact table for each table.
    I'd appreciate any feedback, thanks alot!

    If I am understanding what you are saying, you are saying to duplicate the Region Dim in the Business Layer then join this newly created Logical Table off of the System Dim? So snowflaking it out. But how would that allow me to present the Region column as one column in the Presentation layer? If the user just selected the Region column and a Fact I was hoping the path would just go between that direct join. If they selected only Region and System just have it utilize the dimensional join. Thanks for your response by the way!

Maybe you are looking for

  • A Problem with VSS in the 6509

    Hello, I have a problem with VSS in the 6500, when the switch 1 is active,probably a few months will switchover to switch 2 and switch 1 reload. config: switch virtual domain 1  switch mode virtual  switch 1 priority 110  switch 2 priority 110 interf

  • ORA-20101: Row based mode not supported

    Hi, I'm having this situation: Process flow with 4 mappings ends with 2 mappings successfully and 2 mappings with error: ORA-20101: Row based mode not supported But when I started those mappings separatly (one by one) they've all completed successful

  • Writing smartform output in application server

    Hi, i have a smartform output having logo and other details. After this i am converting the smartform output to PDF file and i tried write into application server using Open Dataset, Close Dataset. The thing is i am unable to see the output in pdf fi

  • Error in inbound IDOCS from XI to SAP

    Hi, We have a migrated system XI 20 to 70 (SP9) and we have adapter engine in 620. When a adapter engine in 620 send a xml message to XI for the R3 system , the XI system doesn't converts well the SNDPRN and SNDPRT. In concret the XI set as SNDPRN =

  • WARNING! Your Flash Player may be out of date. Please update to continue

    Can someone please help me. I have contacted Mac support 3 times and no one can help me and was recommended I go onto this forum. I keep getting a pop up on my Mac, Macbook Pro, iPhone 5 and another MacBook we have in the house. It says "WARNING! You