Maintaining distinct counts in summary tables - thoughts

Hi,
We have a 3bn row transaction fact table of sales by product_id and customer_id.
We have some very large summaries on this. e.g product/multiple.
Wish to add at the summary leveks a distinct count of customers whio have been supplied or returned at these aggregate levels.
At moment,code merges into summary tables latest batch of data on daily basis. Fine for sums, but when updating the summary table only want to read the latest batch of data, rather than having to scan the entire lower level table to get the count(distinct)
How can we efficiently increment the counts but ensuring only increemnt if a brand new customer being supplied.
Mat. views impractical at this stage due to volume of data.
Many Thanks

Hello,
So if you have a calculation(Webi) function(Excel) built into the two tables you are using from the data source you might try 'configuring' the data as 'Occurance' from the workspace you created or after the file in index if you're using excel.  If you are using a universe as a data source for the exploration view set you can attempt to drag the 'measure' needed (count) into the workspace option "measure" when creating the workspace.
I do hope this helps

Similar Messages

  • Distinct count using lookup table

    How can I get a distinct count of column values using a different table?
    Let's say I want to get a distinct count of all "company_name" records in table "emp" that corespond (match) with "lookup" table, "state" category.
    What I want is to find counts for all companies that have a value of "california" in the "state" column of the "lookup" Table. I want the output to look like:
    Sears 17
    Pennys 22
    Marshalls 6
    Macys 9
    I want the result to show me the company names dynamically as I don't know what they are, just that they are part of the "state" group in the lookup Table. Does this make sense?
    M

    Mark,
    In the future you might consider creating test cases for us to work with. Something similar to the following where sample data is created for each table as the union all of multiple select statementsselect 'INIT_ASSESS' lookup_type
         , 1 lookup_value
         , 'Initial Assessment' lookup_value_desc
      from dual union all
    select 'JOB_REF', 2, 'Job Reference' from dual union all
    select 'SPEC_STA', 3, 'SPEC STA' from dual;
    select 'INIT_ASSESS' rfs_category
         , 1 val
      from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'SPEC_STA', null from dual;Then we can either take your select statements and make them the source of a CTAS (create table as) statementcreate table lookup as
    select 'INIT_ASSESS' lookup_type
         , 1 lookup_value
         , 'Initial Assessment' lookup_value_desc
      from dual union all
    select 'JOB_REF', 2, 'Job Reference' from dual union all
    select 'SPEC_STA', 3, 'SPEC STA' from dual;, or include them as subfactored queries by using the with statement:with lookup as (
    select 'INIT_ASSESS' lookup_type
         , 1 lookup_value
         , 'Initial Assessment' lookup_value_desc
      from dual union all
    select 'JOB_REF', 2, 'Job Reference' from dual union all
    select 'SPEC_STA', 3, 'SPEC STA' from dual
    ), RFS as (
    select 'INIT_ASSESS' rfs_category
         , 1 val
      from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'SPEC_STA', null from dual
    select lookup_value_desc, count_all, count_val, dist_val
      from lookup
      join (select rfs_category
                 , count(*) count_all
                 , count(val) count_val
                 , count(distinct val) dist_val
              from RFS group by rfs_category)
        on rfs_category = lookup_type;Edited by: Sentinel on Nov 17, 2008 3:38 PM

  • Prioritizing distinct counts from aggregate table

    I am a relatively new developer with limited PL/SQL experience trying to modify an existing query that extracts counts from an aggregate table. What I need to do is set it up so that it only counts the record once based on it's priority. This is currently set up in a DECODE Statement counting only totals (not distinct nor prioritized). What I’m trying to accomplish would be something like this:
    If Service 'A' exists count it and stop. If more than one Service ‘A’ exists count only once.
    If Service 'A' does not exist then check if 'B' exist, if 'B' exists count it and stop. If more than one Service ‘B’ exists count only once.
    If Service 'B' does not exist then check if 'C' exist, if 'C' exists count it and stop. If more than one Service ‘C’ exists count only once. etc.
    It may be possible to have multiple services in a given category and if so should be counted only once.
    Here is a snipit of the existing code....
    COUNT
    (DECODE (service_id,
    1, program_enrollment_id
    ) basic_readjustment,
    COUNT
    (DECODE (service_id,
    2, program_enrollment_id
    ) occupation_skills,
    COUNT (DECODE (service_id,
    3, program_enrollment_id
    ) on_the_job,
    COUNT
    (DECODE (service_id,
    4, program_enrollment_id
    ) placement_assist
    Any help you can give would be appreciated!
    Mark

    Yes, although based on your last post, it is not quite a simple as my example. Your original query as posted will count each occurence of each service_id whether there is one or many for a group. The DISTINCT on the innermost query, against wia_bas_mv, will remove duplicates for a particular service_id, but would leave multiple records it there were different service_ids for the same group.
    The trick is to to get only one record for each group, and make sure that that record is the "highest" priority record. Since your priority order does not match the sort order of the service_ids, you need to add an extra DECODE to get them to "sort" in the right order. Assuming that I have done the service_id mapping correctly, this should be close to what you are looking for:
    SELECT region_id, region_name, officegroupname, officegroupid,
           SUM(basic_readjustment) basic_readjustment,
           SUM(occupation_skills) occupation_skills,
           SUM(on_the_job) on_the_job, SUM(placement_assist) placement_assist,
           SUM(other) other,
           SUM(basic_readjustment + occupation_skills + on_the_job +
               placement_assist + other) total
    FROM (SELECT officegroupname, officegroupid, region_id, region_name,
                 SUM(DECODE(service_id, 'C', 1, 0)) basic_readjustment,
                 SUM(DECODE(service_id, 'A', 1, 0)) occupation_skills,
                 SUM(DECODE(service_id, 'B', 1, 0)) on_the_job,
                 SUM(DECODE(service_id, 'D', 1, 0)) placement_assist,
                 SUM(DECODE(service_id, 'E', 1, 0) other
          FROM (SELECT program_enrollment_id, officegroupname,
                       officegroupid, region_id, region_name,
                       MIN(DECODE(service_id, 368, 'A', 369, 'B', 144, 'C',
                                              114, 'D', 'E')) service_id
                FROM wia_base_mv
                WHERE region_id < 13 AND
                      program_value = 'VAL04_TAA' AND
                      actual_completion_date IS NULL
                GROUP BY program_enrollment_id, officegroupname,
                         officegroupid, region_id, region_name)
          GROUP BY officegroupname, officegroupid, region_id, region_name
          UNION ALL
          SELECT r.region_id, r.region_name, og.officegroupname,
                 og.officegroupid, 0 basic_readjustment, 0 occupation_skills,
                 0 on_the_job, 0 placement_assist, 0 other
          FROM officegroup og, regions r, office_data od
          WHERE r.region_id = od.region_id AND
                og.officeid = od.office_id)
    GROUP BY region_id, region_name, officegroupname, officegroupid
    ORDER BY region_id HTH
    John

  • Distinct count that ignores NULL

    I am trying to do a distinct count of a field but I do not want any NULL rows to be counted.  Any ideas on how to accomplish this?
    I have created a formula field that returns a date from a different field if certain criteria are met.  If not, it returns  " ".  Now I need to get a distinct count of the dates.  I am not very experienced using Crystal and this has me stumped.

    You can also use a Running Total
    Select the field to be counted, select distinct count from summary list
    In the evaluate section check formula
    In formula editor
    not(isnull(yourfield))
    In the reset section check the appropriate level for resetting.
    Ian

  • Distinct count of dimension business key in fact table

    In my cube I have a fact table which joins to a patient dimension.  The patient dimension is a type 2.  What I would like to do is get a distinct count of patients who have records in the fact table.   The business key in the patient dimension
    is the PrimaryMrn.  So a SQL query would look like this.
    SELECT count(distinct PrimaryMrn)
    FROM EncounterFact e
    INNER JOIN PatientDim p
    on e.PatientKey = p.PatientKey
    Is it possible to do this via MDX?
    Thanks for the help.

    If you have to distinct count an attribute in a SCD 2, you might choose between:
    Denormalizing that attribute in the fact table, and the create a classical DISTINCT COUNT measure
    Use a many-to-many approach - see the "Distinct Count" scenario in the Many-to-Many White paper here:
    http://www.sqlbi.com/articles/many2many (for both Multidimensional and Tabular
    If you use Tabular, you might want to read also this pattern:
    http://www.daxpatterns.com/distinct-count/
    Marco Russo http://www.sqlbi.com http://www.powerpivotworkshop.com http://sqlblog.com/blogs/marco_russo

  • Distinct count for multiple fact tables in the same cube

    I'm fairly new to working with SSAS, but have been working with DW environments for many years.
    I have a cube which has 4 fact tables.  The central fact table is Encounter and then I also have Visit, Procedure and Medication.  Visit, Procedure and Medication all join to Encounter on Encounter Key.  The relationship between Encounter
    and Procedure and Encounter and Medication are both an optional 1 to 1.  The relationship between Encounter and Visit is an optional 1 to many.
    Each of the fact tables join to the Patient dimension on the Patient Key.  The users are looking for a distinct count of patients in all 4 fact tables.  
    What is the best way to accomplish this so that my cube does not talk all day to process?  Please let me know if you need any more information about my cube in order to answer this.
    Thanks for the help,
    Andy

    Hi Andy,
    Each distinct count measure cause an ORDER BY clause in the SELECT sent to the relational data source during processing. In SSAS 2005 or later, it creates a new measure group for each distinct count measure(it's a technique strategy for improving perormance).
    Besides, please take a look at the following distinct count optimization techniques:
    Create Customized Aggregations
    Define a Processing Plan
    Create Partitions of Equal Size
    Use Partitions Comprised of a Distinct Range of Integers
    Distribute the Hash of Your UserIDs
    Modulo Function
    Hash Function
    Choose a Partitioning Strategy
    For more detail information, please refer to the article below:
    Analysis Services Distinct Count Optimization:
    http://www.microsoft.com/en-us/download/details.aspx?id=891
    In addition, here is a good article about SSAS Best Practices for your reference:
    http://technet.microsoft.com/en-us/library/cc966525.aspx
    If you have any feedback on our support, please click
    here.
    Hope this helps.
    Elvis Long
    TechNet Community Support

  • I want a count of distinct rows in a table

    I want a count of distinct rows in a table through a single query -- is it possible?
    eg.
    table-
    create table ch1 (a int, b int, c int, d int)
    insert ch1 values (1,1,1,1)
    insert ch1 values (2,2,2,2)
    insert ch1 values (1,1,1,1)
    insert ch1 values (2,2,2,2)
    insert ch1 values (1,3,4,5)

    hi,
    create table ch1 (a int, b int, c int, d int) ;
    insert into  ch1 values (1,1,1,1);
    insert into  ch1 values (2,2,2,2);
    insert  into  ch1 values (1,1,1,1);
    insert into  ch1 values (2,2,2,2);
    insert into  ch1 values (1,3,4,5);
    SQL> select * from ch1;
             A          B          C          D
             1          1          1          1
             2          2          2          2
             1          1          1          1
             2          2          2          2
             1          3          4          5
    SQL> select distinct * from ch1;
             A          B          C          D
             1          1          1          1
             1          3          4          5
             2          2          2          2
    SQL>
      1* select count(*) from( select distinct * from ch1)
    SQL> /
      COUNT(*)
             3
    SQL> ed
    Wrote file afiedt.buf
      1   select count(*) from (select a,b,c,d  from ch1
      2* group by a,b,c,d)
    SQL> /
      COUNT(*)
             3
    SQL> Thanks,
    P Prakash

  • SQL DISTINCT COUNT IN DATE RANGE

    Dear All
    Thanks for your attention.
    A table is storing the task summary of each order
    e.g.
    Date                            | Order Number    | Task Number
    2015-01-01 00:00:01   | ABC123456        | JOB001
    2015-01-01 00:01:02   | ABC123456        | JOB002
    2015-01-01 00:10:02   | ABC123444        | JOB001
    2015-01-01 10:12:59   | ABC123456        | JOB002   (Since the job002 is not done correctly, need to work again)
    2015-01-01 18:20:05   | ABC888888        | JOB001
    2015-01-01 20:22:42   | ABC789456        | JOB001
    2015-01-01 21:02:11   | BBB121212        | JOB002
    I would like to write a single query that get the distinct count of order number in sepcific date range
    result as expected in three columns:
    2015-01-01
    task_number            | AM | PM
    JOB001         | 2    | 2
    JOB002         | 1    | 1
    explain the figures here:
    JOB001 AM = 2 (ABC123456, ABC123444)
    JOB002 AM = 1  (two records of ABC123456 count as 1 since we would like to know the number of orders)
    JOB001 PM = 2  (ABC888888, ABC789456)
    JOB002 PM = 1  (BBB121212)
    I wrote a query get similar result but the count of order is not distinct
    SELECT task_number,
    AM=SUM(CASE WHEN date >= ('2015-01-01 00:00:00') AND date < ('2015-01-01 12:00:00') THEN 1 ELSE 0 END),
    PM=SUM(CASE WHEN date >= ('2015-01-01 12:00:00') AND date < ('2015-01-02 00:00:00') THEN 1 ELSE 0 END)
    FROM MyTable
    WHERE task_number = 'JOB001'
    Could anyone advise how to enhance this query to let the result become disintct of order number?
    Many Thanks,
    swivan

    Try
    select task_number,
    count(distinct case when datepart(hour, [date]) >=0 and datepart(hour, [date]) < 12 then [OrderNumbers] END) as AM,
    count(distinct case when datepart(hour, [date]) >=12 and datepart(hour, [date]) < 24 then [OrderNumbers] END) as PM FROM myTable
    GROUP BY Task_Number
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles
    Thank you very much,  short and good answer

  • Distinct Count Function-how to use properly

    Hello,
    I am new to using forums & have only been using Crystal since May of 2009, so i hope i do this correctly & provide the appropriate information.  i've looked for this answer in what's been posted but cannot find it.  Some things i've read I don't really understand.  I only know how to use the functions that are in the software, i don't know how to write them myself (i think that's when people have referred to SQL code or basic syntax)
    I have CR Professional, version 11.0.0.1282 (Crystal Reports XI).
    I work at a county health dept and we have a annual medicaid cost report,  I am linking Crystal to our EMR billing module.  i have my report sorted by insurance, ie medicaid, bcbs, abw, hpm etc.  and within each ins group i have the clients ID, DOS (date of service), procedure code, charge amt, ins pmt & patient pmt.  i have totaled the charges & pmts for each group-works fine.  i even have been able to create the formula to adj out the duplicate entries in the billing module (a service was entered wrong then adjusted out then re-entered correctly-without my formula crystal was pulling both these records and adding them to total charges.)
    Where my problem lies and what my question is:  I need to count encounters, an encounter is the visit, but each visit could have 2 or more procedure codes.   So this results in multiple lines on my report for one visit, which i want for the charges to add correctly, but it makes my visit count to high. So I read about the distinct count function, of which there are three listed & i'm having a hard time understanding the differences.  What i tried is: a distinct count of the acct ID-so the same acct ID's are only counted the one time.  But some clients see us more than once per year, meaning the acct ID is the same but the DOS is different.  For this client that would be 2 visits.  But crystal is counting this as 1.
    Saying what i want to do is this:  Count as 1 when the acct ID and DOS are the same.  I've tried using the different distinct counts but when i check my formula it always has errors.  So I'm sure my lack of knowledge is what's holding me up-i fully believe crystal can do this.
    Any help would be greatly appreciated.

    I create a dummy table, set up acc_id and DOS and Charge.
    Created a running total
    Summarized acc_id
    Type of summary Count
    Evaluated using a formula
         <> previous ()
    and reset on ACC_ID
    My groups were sorted by acc_id and date
    where there were multiple visits on the same DOS my count was 0
    where the dos changed it would count accordingly.
    You may need to use two Running totals to get the complete picture.

  • Count records in table where fields not used in Report

    Hi
    I was wondering if anyone could help me with a problem I have. I am new to Crystal Reports... I am using CR2008 and XSD as a datasource.
    I have the following tables used in the report.
    Programme Table          Risk Table          Control Table          Test Table
    ID               ID               ID               ID
    Name               ProgrammeID          RiskID               ControlID
    Details               Description          Description          Description
    Opinion               Notes               Notes               Notes
                   Risk Recs Table          Control Recs Table     Test Rec Table
                   ID               ID               ID     
                   RiskID               ControlID          TestID
                   Description          Description          Description
    In the report that I have to design, I need to display the Notes from each of the Risk, Control and Test tables in hierarchical order and also display the notes when there are one or more recommendations attached to each Notes.
              Risk Notes     - Display only when risk rec count <> 0
              Control Notes     - Display only when control rec count <> 0
              Test Notes     - Display only when test rec count <> 0
    So far I have designed the report as follows:
    I have grouping around the Risk Notes, Control Notes and Test Notes as
         Group 1 - Group by ProgrammeID
         Group 2 - Group by RiskID
         Group 3 - Group by ControlID
         Group 4 - Group by TestID
    (This is giving me the notes in the order that I want)
    Since I want to know if each of the risk, control and test have got any recommendations, I created summary counts to get the recommendation count for Risk, Control and Tests. But I am not able to get the right count. Effectively, what I need to do is go through the Risk Recommendation table and count the recommendations that belong to that particular RiskID. If the count = 0 then I want to supress the Risk Notes (Group Header 2.)
    Can anyone suggest how to get the count?
    Thanks

    Hi
    I am using Distinct Count.
    When there are no recommendations then the count always comes out as 1 and the count is correct for the first grouping. After that even if there are more than one recommendation, the count is always 1!
    How do I reset a summary count?
    I even tried writing a formula to do the count..
    NumberVar riskCount;
    WhilePrintingRecords;
    riskCount := DistinctCount ({RiskRec.ID}, {Control.RiskID})
    and another formula to reset this count, even then the count is still coming out incorrect. It brings a value 1 when there are no recommendations and the count is right for one set of grouping only.
    I have just recently started using CR and havent quite mastered it yet!
    Thanks...

  • Summary Tables Questions...

    Hi to everybody,
    I use Oracle Discoverer 10.1.2 and created some summary tables - using both methods : being specified by me and Discover automatically defined them....
    I have two questions:
    1) Is there any way to define the summary table(materialized view in the 'language' of Oracle Database ) in the application db user and not in the Discoverer Repository db owner.....????
    NOTE: I have created the Discoverer Repository in a user , let's say EUL, whereas all referenced tables in the summary tables are owned in another user , say HIS...
    Simply , I ask if a summary table can be created in the HIS dataschema and not in EUL.....
    2)Is there any way to give the summary table a more meaningful name in the process of creating it..... I mean a name different from this one: EUL5_MV102497
    Thanks , a lot
    Simon

    Hi Simon
    As mentioned by Sabine, if you create the materialized views in the database you have full control. To answer your question I always build my summary tables in the schema of the user who owns the EUL.
    However, I would have thought that you can do what you ask, but I'm not so sure. In theory, all you need to do in order to make this work is to make sure the EUL owner and the owner of the schema into where you want to insert the summary table has the following privileges:
    These are the grants the EUL needs:
    ALTER ANY MATERIALIZED VIEW
    CREATE ANY MATERIALIZED VIEW
    DROP ANY MATERIALIZED VIEW
    ANALYZE ANY
    These are the privileges needed by the user in whose schema you intend to create the materialized view:
    CONNECT
    RESOURCE
    GLOBAL QUERY REWRITE
    With these privileges granted you should be able to create summary tables inside Discoverer and have full control over the schema in which the materialized view is created and the name of the materialized view. I say should be able to because it doesn't seem to work. Please read on.
    To control the MV schema and name, I should be able to use this workflow:
    1. When you are in the manual summary folder process, you will come to a screen that allows you to maintain Combinations.
    2. From the Combinations screen, highlight a combination and click the Properties button.
    3. The Database Storage Properties dialog box will open.
    4. In the Database Storage Properties dialog box, use the drop-down alongside the Table Owner and switch this to be a user who has the privileges mentioned earlier.
    Note: the drop-down is not visible until you click in the Table Owner box
    5. Click in Table Name (this is the name of the materialized view) and change it to a name that complies with your naming standards.
    6.Change any other properties you wish, then click OK.
    7. Click Finish to complete the summary folder.
    At this point, even though I had granted the Global Query Rewrite to the other user, Discoverer Admin stopped and reported that the user needed this privilege. I was therefore unable to complete the summary folder process. Interestingly enough, the materialized view was actually created but I, as the owner of the EUL, was unable to use it. This is because in order for the EUL owner to be able to use an existing MV / Table that is owned by someone else, the other user needs to have run a grant like this:
    GRANT SELECT ON MY_MV TO EUL_OWNER WITH GRANT OPTION
    But how can this be done because the table is being created by me? The problem therefore is that only the owner of the MV can grant this but when you are inside Discoverer Admin you are not logged in as that user. I therefore am suspicious that, despite Discoverer having a screen to do so, it is not possible to create a summary table in someone else's account.
    Has anyone been able to make this work?
    In summary though, if the intention is to produce a materialized view that everyone can use then the above doesn't appear to work. However, it looks like you are able to create a materialized view within a user's schema that is only available to that user. This opens up the interesting possibility that you could create different materialized views for different users, thus giving users individual copies and potentially different copies of the data.
    It would be interesting if someone were to test this out and report back. My only concern would be that once created, because it is the EUL owner who has the ALTER and DROP privileges, how would the schema owner update it? As I say, this is an interesting conumdrum.
    Personally, as stated at the beginning, I always create my summary folders (aka materialized views) in the EUL owner's schema.
    I hope this helps
    Best wishes
    Michael Armstrong-Smith
    URL: http://learndiscoverer.com
    Blog: http://learndiscoverer.blogspot.com

  • DAX - Unique count between RELATED tables

    Hi all,
    Having a little trouble with the RELATEDTABLE function.  I'm trying to get a distinct count of a specific value from one table into another table.  I want to get the total count of "Red" from the 'Color' table into the 'Master' table
    for each unique ID.
    The 'Color' table is this:
    ID
    Color
    1
    Red
    2
    Green
    3
    Red
    1
    Green
    2
    Red
    3
    Red
    1
    Red
    The 'Master' table should look like this in the end:
    ID
    Name
    Red
    1
    John
    2
    2
    Mark
    1
    3
    Jason
    2
    Any thoughts?  Thanks.
    UG1

    Sounds like this
    =COUNTROWS(FILTER(RELATEDTABLE(TabB),TabB[Color]="RED"))
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How do I solve this distinct count problem?

    Hello experts,
      So, I have an OBI report (table view).  I needed to get the percentage difference btn 2 columns, I did. Then I had to summarize difference in 4 buckets (0-15, 16-30, 31-50, >50%); I did (case statement). NOW,  I need to summarize(distinct count) the above buckets based on Store numbers for each day.
    Basically, if the difference is btn(0-5%) and I have 5 stores then I need to see 5 stores separately. The problem I am having when I do the distinct count instead of having separate counts for each bucket I am getting the total.  I see the buckets summarized, but the store column is showing the total number of all(we have about 700 stores) instead of breaking down the count for each bucket.  In the stores column I am using the distinct count function, I don't know if the problem is here or the case statement for buckets. I don't know either OBIEE is able to do what I trying to do, since I have yet to do this kind of function.  I have gotten few leads on my first post,  so far none of them have worked.
    As always, your insights are highly appreciated,

    Instead of using Distinct Count in Aggregation Rule,Try using in Column Formula.
    Let me know if u need any help on this.
    Thanks,

  • How to link a summary table

    Post Author: strife
    CA Forum: General
    I am using Crystal 10 and trying to develop a donor percent participation report, comparing donors to total number of class members (donors per class/good addresses per class) * 100.  The number of class members comes from a summary table of good address counts that remains static throughout the year.
    1)      I can create a view for the good address counts but Iu2019m unclear as to the way to link this view to the table of donors.  I canu2019t link ID to ID since itu2019s a summary and doesnu2019t have a row per ID (I need address counts for ALL IDs not just the ones who are donors). 
    2)      If I put the view in a subreport, I get only one result not a count for each group which is class year. 
    3)      If I put the subreport in the class year group to get a result returned for each class but the subreport creates unwanted blank rows in the export to Excel.
    I am looking at the last option but wonder if there is some other way that Iu2019m overlooking.  Any help is appreciated.

    Here is the video!  and it works for 2010.  It shows you how to put the pivot wizard that you need on the ribbon.
    https://www.youtube.com/watch?v=pUXJLzqlEPk
    Excel Pivot Tables: How to flatten a cross tab table
    Note:  the above instructions for 2007 and 2003 work as well BUT you must let go of the "alt" & "d" when you press "P"!

  • Distinct Count doesn't return the expected results

    Hi All,
    I was fighting a little trying to implement a Distinct Count measure over an account dimension in my cube. I read a couple of posts relateed to that and I followed the steps posted by the experts.
    I could process the cube but the results I'm getting are not correct. The cube is returning a higher value compared to the correct one calculated directly from the fact table.
    Here are the details:
    Query of my fact table:
    select distinct cxd_account_id,
              contactable_email_flag,
              case when recency_date>current_date-365 then '0-12' else '13-24' end RECENCY_DATE_ROLLUP,
              1 QTY_ACCNT
    from cx_bi_reporting.cxd_contacts
    where cxd_account_id<>-1 and recency_date >current_date-730;
    I have the following dimensions:
         Account (with 3 different hierarchies)
         Contactable Email Flag (Just 3 values, Y, N, Unknown)
         Recency_date (Just dimension members)
    All dimensions are sparse and the cube is a compressed one. I defined "MAXIMUM" as aggregate for Contactable Email flag and Recency date and at the end, SUM over Account.
    I saw that there is a patch to fix an issue when different aggregation rules are implemented in a compressed cube and I asked the DBA folks to apply it. They told me that the patch cannot be applied because we have an advanced version already installed (Patch 11.2.0.1 ).
    These are the details of what we have installed:
          OLAP Analytic Workspace       11.2.0.3.0 VALID
          Oracle OLAP API 11.2.0.3.0 VALID
          OLAP Catalog 11.2.0.3.0 VALID
    Is there any other patch that needs to be applied to fix this issue? Or it's already included in the version we have installed (11.2.0.3.0)?
    Is there something wrong in the definition of my fact table and that's why I'm not getting the right results?
    Any help will be really appreciated!
    Thanks in advance,
    Martín

    Not sure I would have designed the dimensions /cubes as you,  but there is another method you can obtain distinct counts.
    Basically relies on using basic OLAP DML Expression language and can be put in a Calculated Measure, or can create two Calculated measures
    to contain each specific result.  I use this method to calculate distinct counts when I want to calculate averages, etc ...
    IF account_id ne -1 and (recency_date GT today-365) THEN -
    CONVERT(NUMLINES(UNIQUELINES(CHARLIST(Recency_date))) INTEGER)-
    ELSE IF account_id ne -1 and (recency_date GT today-730 and recency_date LE today-365) THEN -  
    CONVERT(NUMLINES(UNIQUELINES(CHARLIST(Recency_date))) INTEGER)-
    ELSE NA
    This exact code may not work in your case, but think you can get the gist of the process involved.
    This assumes the aggregation operators are set to the default (Sum), but may work with how you have them set.
    Regards,
    Michael Cooper

Maybe you are looking for

  • Using Instr in Cursors or Loops...?

    Can anyone suggest me how to use "Instr" to find one parameter string in another parameter string, finding if one string is present in another using loops..?? Edited by: user11339127 on Jul 1, 2009 11:04 PM

  • Codepage issue when connecting to SAP R/3 under Mac OS X

    Hello, I am trying to connect to my enterprise SAP R/3 4.6c backend via the SAPGui for Java 7.00R3 for Mac OS X. I am currently using Mac OS X 10.4.9, on a Macbook (Intel based). However, at every attempt, I get a error message for an invalid codepag

  • Datetime pickers

    i need to add some time and date pickers to my aplication, it's a jdeveloper 10g adf bc swing application, but i don´t know how to find this pickers, can someone help me?.. i need a tutorial or something like that.

  • Downloading instead of using disks

    I bought Adobe Photoshop several years ago (via disks).  I'm getting a new laptop that doesn't have a disk drive.  If I still have my adobe disk and serial number, can I download adobe from the website without charge?

  • Ipad not recognizing charger nor computers

    My Ipad does not recognize my computers therefore I cannot reset all contents and settings from Itunes. It does only recognize the charger after holding down the home and sleep buttons but on the right top corner I read "not charging". When I put it