Count distinct can not be aggregate

Hi All,
I create discoverer report and then create calculation by using Count Distinct function in this cal. when I create total on this calculation the data could not be shown on report.
How to correct this problem ? But I don't want to create Custom folder because
If use this method I must create a lot of custom folder to support all reports
Thank you
Mcka

Yes, that's right. Normally when you ask Discoverer to create a total it will use the SUM command. The SUM command is a function that adds up all the columns with natural numbers, but for columns with calculations it tries to do a SUM of the calculation. Many times this will work but sometimes the formula becomes impossibe and you end up with nothing in the total.
CELL SUM tells the system to literally add up the values in the column above and ignore the underlying formulas, hence it has a better chance of evaluating the total when there are functions being used in the calculations.
Does this help
Regards
Michael

Similar Messages

  • Logical Aggregate Column (count(distinct)) Does Not Group for SQL Server DB

    When utilizing the count(distinct column_name) aggregate function within a Logical Fact source in the Business Model and Mapping layer in the RPD file the output in BI Answers is not grouping correctly for SQL Server 2008 database sources only. All Oracle database sources represent the same aggregate column correctly within BI Answers.
    I am using OBIEE version 10.1.3.3.3
    Does anyone know how to resolve this issue?
    Thanks in advance,
    Kyle

    I thought that I would update my current findings with this issue. If you display the report in BI Answers as a Pivot Table view the aggregate column displays properly, it does not in a Table or Compound Layout view for some reason. I am still working with Oracle Support on this.

  • Count Distinct Wtih CASE Statement - Does not follow aggregation path

    All,
    I have a fact table, a day aggregate and a month aggregate. I have a time hierarchy and the month aggregate is set to the month level, the day aggregate is set to the day level within the time hierarchy.
    When using any measures and a field from my time dimension .. the appropriate aggregate is chosen, ie month & activity count .. month aggregate is used. Day & activity count .. day aggregate is used.
    However - when I use the count distinct aggregate rule .. the request always uses the lowest common denominator. The way I have found to get this to work is to use a logical table source override in the aggregation tab. Once I do this .. it does use the aggregates correctly.
    A few questions
    1. Is this the correct way to use aggregate navigation for the count distinct aggregation rule (using the source override option)? If yes, why is this necessary for count distinct .. what is special about it?
    2. The main problem I have now is that I need to create a simple count measure that has a CASE statement in it. The only way I see to do this is to select the Based on Dimensions checkbox which then allows me to add a CASE statement into my count distinct clause. But now the aggregation issue comes back into play and I can't do the logical table source override when the based on dimensions checkbox is checked .. so I am now stuck .. any help is appreciated.
    K

    Ok - I found a workaround (and maybe the preferred solution for my particular issue), which is - Using a CASE Statement with a COUNT DISTINCT aggregation and still havine AGGREGATE AWARENESS
    To get all three of the requirements above to work I had to do the following:
    - Create the COUNT DISTINCT as normal (counting on a USERID physically mapped column in my case)
    - Now I need to map my fact and aggregates to this column. This is where I got the case statement to work. Instead of trying to put the case statement inside of the Aggregate definition by using the checkbox 'Base on Dimension' (which didnt allow for aggregate awareness for some reason) .. I instead specified the case statement in the Column Mapping section of the Fact and Aggregate tables.
    - Once all the LTS's (facts and aggregates) are mapped .. you still have to define the Logical Table Source overrides in the aggregate tab of the count distinct definition. Add in all the fact and aggregates.
    Now the measure will use my month aggregate when i specify month, the day aggregate when i specify day, etc..
    If you are just trying to use a Count Distinct (no CASE satement needed) with Aggregate Awareness, you just need to use the Logical Table Source override on the aggregate tab.
    There is still a funky issue when using the COUNT aggregate type. As long as you dont map multiple logical table sources to the COUNT column it works fine and as expected. But, if you try to add in multiple sources and aggregate awareness it randomly starts SUMMING everything .. very weird. The blog in this thread says to check the 'Based on Dimension' checkbox to fix the problem but that did not work for me. Still not sure what to do on this one .. but its not currently causing me a problem so I will ignore for now ;)
    Thanks for all the help
    K

  • Who worked with ICS' Model 4896 GPIB? I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    Hello. Most of the engineers in developer exchange are more familiar
    with NI products. Contacting ICS for technical support is a better
    course of action.

  • LX26, Quant for storage bin can not be counted

    T code LX26 , executed for a WH/storage Type .The report displays some bins as Ready/Blocked or Overdue /Blocked and when trying to activate those for counting the error message flashes -
    Quant for storage Types XXX can not be counted .
    How can I unblock these bins and activate for cycle counting.Please help

    you must not have any open TO for this quant
    the quant must have a positive quantity, negative quants cannot be counted
    make sure that this quant is not included in any other still open count

  • L can not find my playlist,play count, etc. on my new macbook itunes

    I have recently purchased a macbook. i have about 22G of music oon my external hard drive. I have moved about 6G of music from my external HD to my macbook. I can not figure out how to get my playlist, play counts and ratings on the macbook. I do not want to add all of my original itune music 22G because i will be away with my laptop and i need the space for other things. I am not able to bring the External HD. I hope someone can help me with this. thanks

    To transfer your iTunes metadata (tags, playcounts, playlists, etc) you need to locate and transfer the iTunes Music Library file from the original computer to the MacBook.
    The easiest way to do that is to export the iTunes Library data as an XML file, email to yourself, and save it on the MacBook's desktop.
    Now open iTunes and from the file menu, select Import, and navigate to the xml file, and select. This will add all of the data you are looking to put on the MacBook. However, you will get all of the songs - not just those that were added to the MacBook's hard drive. These will have the dreaded next to the name. If you can live with this, this is the easiest way to add your metadata.
    Lita

  • HELP: PCR using AAU** can not count   absence days that less than a day

    Hi, experts
    I  have  customized a  PCR using AAU**
    But it  can not count  absence days that less than a day which is maintained  in  IT 2001 ,
    such as  unpaid leave. However it can correctly  count  absence days that  last  one  day  or above .
    The issue is so strange for me, so please give me some advice.
    Thanks a lot !
    Morgan  from  Shanghai, China
    2011-6-10

    Morgan
    1 alternative approach is as follows:
    Step 1: Ensure your absence type have already been mapped to an absence valuation rule
    Step 2: In your absence valuation rule, (goto SM30 > V_t554c), assign a new wage type to capture the number of days
                 The wage type in step 2 should be created such that its attributes is to help your capture number of days of your unpaid
                 absence type when it is evaluated by your payroll schema
    Final Step: You should be able to capture half day absences with such a wage type when you run your payroll calculations
    Should you need to utilize such a wage type for subsequent calculation processing in your payroll schema, you may have to develop your own customer payroll calculation rules to do so

  • OBIEE 10G Total by in answers not correct for count distinct fields. Is this a bug?

    For example:
    Sales fact has receipt no  and line no as key. It has data like:
    receipt no, line no, value
    1, 1, 30
    1, 2, 40
    2, 1, 10
    2, 2, 10
    There is also a transaction field defined as count distinct of receipt no (in BMM)
    In answers, I set to show Total.
    without any filters:
    receipt no, value, transactions
    1, 70, 1
    2, 20, 1
    total: 90, 2
    Transactions is 2, which is correct.
    If apply filter of transaction value greater than 50.
    Then transactions in total will still show 2
    1, 70, 1
    total: 70, 2
    Is this a bug? It looks only SUM works no problem in the total by.

    I did look at the physical query and saw how it calculated the Total transactions and it didn't take into account of the filter of transaction value greater than 50. Don't know why though. I don't know why you want to count line no. The result would be still 2.

  • Count distinct in case statement

    SELECT A.P_ID,
    B.P_NAME,
    C.P_DESC,
    SUM(CASE
    WHEN A.DATE BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(SYSDATE),-4) + 1) AND ADD_MONTHS(LAST_DAY(TO_DATE(SYSDATE)),-1)
    AND A.M_ID IS NOT NULL
    THEN 1
    ELSE 0
    END) AS COUNT,
    SUM(CASE
    WHEN A.DATE BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(SYSDATE),-4) + 1) AND ADD_MONTHS(LAST_DAY(TO_DATE(SYSDATE)),-1)
    AND A.M_ID IS NOT NULL
    THEN COUNT(DISTINCT A.M_ID)
    ELSE 0
    END) AS UNIQUE_COUNT, /* Not possible */
    SUM(CASE
    WHEN A.DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND ADD_MONTHS(LAST_DAY(TO_DATE(SYSDATE)),-1)
    THEN A.AMT_1
    ELSE 0
    END) AS TOTAL_AMT_1,
    SUM(CASE
    WHEN A.DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND ADD_MONTHS(LAST_DAY(TO_DATE(SYSDATE)),-1)
    THEN A.AMT_2
    ELSE 0
    END) AS TOTAL_AMT_2
    FROM TABLE_A A,
    TABLE_B B,
    TABLE_C C
    WHERE A.P_ID = B.P_ID
    AND B.PT_ID = C.PT_ID
    GROUP BY A.P_ID,
    B.P_NAME,
    C.P_DESC
    Hi,
    This is a simplified version of my query.
    I am trying to do 4 things here,
    1. count A.M_ID
    2. count distinct A.M_ID, this is where I have a problem.
    3. and 4. Its just the sum from 2 diff columns.
    Note that the dates for count and amt are different and I can't hard code them.
    Can any one help me in the distinct count step?
    This query is also running kinda slow.
    So any suggestions, comments are very welcome.
    Note: TABLE_A has 700 million recs, TABLE_B 4 million and TABLE_c is just 500 recs
    Thanks!

    Taking advantage of the fact that most aggregate functions ignore nulls, you could do something like:
    SELECT a.p_id, b.p_name, c.p_desc,
           COUNT(CASE WHEN a.date BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(sysdate),-4) + 1) AND
                                          ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) AND
                           a.m_id IS NOT NULL THEN m_id END) AS countall,
           COUNT(DISTINCT CASE WHEN a.date BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(sysdate),-4) + 1) AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) AND
                         a.m_id IS NOT NULL THEN a.m_id END) AS unique_count, /* entirely possible */
           SUM(CASE WHEN a.date BETWEEN TRUNC(sysdate,'YEAR') AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) THEN a.amt_1
                    ELSE 0 END) AS total_amt_1,
           SUM(CASE WHEN A.DATE BETWEEN TRUNC(sysdate,'YEAR') AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) THEN A.AMT_2
                    ELSE 0 END) AS TOTAL_AMT_2
    FROM table_a a, table_b b, table_c c
    WHERE a.p_id = b.p_id and
          b.pt_id = c.pt_id
    GROUP BY a.p_id, b.p_name, c.p_descThe two case statements inside the COUNT return either a.m_id or NULL. A simplified test case is:
    SQL> WITH t as (
      2     SELECT 1 m_id, 9 dt FROM dual UNION ALL
      3     SELECT 1 m_id, 6 dt FROM dual UNION ALL
      4     SELECT 2 m_id, 9 dt FROM dual UNION ALL
      5     SELECT 2 m_id, 6 dt FROM dual UNION ALL
      6     SELECT 1 m_id, 5 dt FROM dual UNION ALL
      7     SELECT 2 m_id, 5 dt FROM dual UNION ALL
      8     SELECT null m_id, 9 dt FROM dual)
      9  SELECT count(CASE WHEN dt BETWEEN 6 and 9 THEN m_id end) cid,
    10         count(distinct CASE WHEN dt BETWEEN 6 and 9 THEN m_id end) cdid
    11  FROM t;
           CID       CDID
             4          2I'm not entirely sure that you actually need the a.m_id IS NOT NULL predicate in the CASE statements, but I left it to be safe.
    John

  • COUNT(DISTINCT) WITH ORDER BY in an analytic function

    -- I create a table with three fields: Name, Amount, and a Trans_Date.
    CREATE TABLE TEST
    NAME VARCHAR2(19) NULL,
    AMOUNT VARCHAR2(8) NULL,
    TRANS_DATE DATE NULL
    -- I insert a few rows into my table:
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Anna', '110', TO_DATE('06/01/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Anna', '20', TO_DATE('06/01/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Anna', '110', TO_DATE('06/02/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Anna', '21', TO_DATE('06/03/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Anna', '68', TO_DATE('06/04/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Anna', '110', TO_DATE('06/05/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Anna', '20', TO_DATE('06/06/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Bill', '43', TO_DATE('06/01/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Bill', '77', TO_DATE('06/02/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Bill', '221', TO_DATE('06/03/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Bill', '43', TO_DATE('06/04/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    INSERT INTO TEST ( TEST.NAME, TEST.AMOUNT, TEST.TRANS_DATE ) VALUES ( 'Bill', '73', TO_DATE('06/05/2005 08:00:00 PM', 'MM/DD/YYYY HH12:MI:SS PM') );
    commit;
    /* I want to retrieve all the distinct count of amount for every row in an analytic function with COUNT(DISTINCT AMOUNT) sorted by name and ordered by trans_date where I get only calculate for the last four trans_date for each row (i.e., for the row "Anna 110 6/5/2005 8:00:00.000 PM," I only want to look at the previous dates from 6/2/2005 to 6/5/2005 and get the distinct count of how many amounts there are different for Anna). Note, I cannot use the DISTINCT keyword in this query because it doesn't work with the ORDER BY */
    select NAME, AMOUNT, TRANS_DATE, COUNT(/*DISTINCT*/ AMOUNT) over ( partition by NAME
    order by TRANS_DATE range between numtodsinterval(3,'day') preceding and current row ) as COUNT_AMOUNT
    from TEST t;
    This is the results I get if I just count all the AMOUNT without using distinct:
    NAME     AMOUNT     TRANS_DATE     COUNT_AMOUNT
    Anna 110 6/1/2005 8:00:00.000 PM     2
    Anna 20 6/1/2005 8:00:00.000 PM     2
    Anna 110     6/2/2005 8:00:00.000 PM     3
    Anna 21     6/3/2005 8:00:00.000 PM     4
    Anna 68     6/4/2005 8:00:00.000 PM     5
    Anna 110     6/5/2005 8:00:00.000 PM     4
    Anna 20     6/6/2005 8:00:00.000 PM     4
    Bill 43     6/1/2005 8:00:00.000 PM     1
    Bill 77     6/2/2005 8:00:00.000 PM     2
    Bill 221     6/3/2005 8:00:00.000 PM     3
    Bill 43     6/4/2005 8:00:00.000 PM     4
    Bill 73     6/5/2005 8:00:00.000 PM     4
    The COUNT_DISTINCT_AMOUNT is the desired output:
    NAME     AMOUNT     TRANS_DATE     COUNT_DISTINCT_AMOUNT
    Anna     110     6/1/2005 8:00:00.000 PM     1
    Anna     20     6/1/2005 8:00:00.000 PM     2
    Anna     110     6/2/2005 8:00:00.000 PM     2
    Anna     21     6/3/2005 8:00:00.000 PM     3
    Anna     68     6/4/2005 8:00:00.000 PM     4
    Anna     110     6/5/2005 8:00:00.000 PM     3
    Anna     20     6/6/2005 8:00:00.000 PM     4
    Bill     43     6/1/2005 8:00:00.000 PM     1
    Bill     77     6/2/2005 8:00:00.000 PM     2
    Bill     221     6/3/2005 8:00:00.000 PM     3
    Bill     43     6/4/2005 8:00:00.000 PM     3
    Bill     73     6/5/2005 8:00:00.000 PM     4
    Thanks in advance.

    you can try to write your own udag.
    here is a fake example, just to show how it "could" work. I am here using only 1,2,4,8,16,32 as potential values.
    create or replace type CountDistinctType as object
       bitor_number number,
       static function ODCIAggregateInitialize(sctx IN OUT CountDistinctType) 
         return number,
       member function ODCIAggregateIterate(self IN OUT CountDistinctType, 
         value IN number) return number,
       member function ODCIAggregateTerminate(self IN CountDistinctType, 
         returnValue OUT number, flags IN number) return number,
        member function ODCIAggregateMerge(self IN OUT CountDistinctType,
          ctx2 IN CountDistinctType) return number
    create or replace type body CountDistinctType is 
    static function ODCIAggregateInitialize(sctx IN OUT CountDistinctType) 
    return number is 
    begin
       sctx := CountDistinctType('');
       return ODCIConst.Success;
    end;
    member function ODCIAggregateIterate(self IN OUT CountDistinctType, value IN number)
      return number is
      begin
        if (self.bitor_number is null) then
          self.bitor_number := value;
        else
          self.bitor_number := self.bitor_number+value-bitand(self.bitor_number,value);
        end if;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateTerminate(self IN CountDistinctType, returnValue OUT
      number, flags IN number) return number is
      begin
        returnValue := 0;
        for i in 0..log(2,self.bitor_number) loop
          if (bitand(power(2,i),self.bitor_number)!=0) then
            returnValue := returnValue+1;
          end if;
        end loop;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateMerge(self IN OUT CountDistinctType, ctx2 IN
      CountDistinctType) return number is
      begin
        return ODCIConst.Success;
      end;
      end;
    CREATE or REPLACE FUNCTION CountDistinct (n number) RETURN number 
    PARALLEL_ENABLE AGGREGATE USING CountDistinctType;
    drop table t;
    create table t as select rownum r, power(2,trunc(dbms_random.value(0,6))) p from all_objects;
    SQL> select r,p,countdistinct(p) over (order by r) d from t where rownum<10 order by r;
             R          P          D
             1          4          1
             2          1          2
             3          8          3
             4         32          4
             5          1          4
             6         16          5
             7         16          5
             8          4          5
             9          4          5buy some good book if you want to start at writting your own "distinct" algorythm.
    Message was edited by:
    Laurent Schneider
    a simpler but memory killer algorithm would use a plsql table in an udag and do the count(distinct) over that table to return the value

  • Count Distinct over a Window

    Hi everyone,
    An analyst on my team heard of a new metric called a "Stickiness" metric. It basically measures how often users are coming to your website overtime.
    The definition is as follows:
    # Unique Users Today/#Unique users Over Last 7 days
    and also
    # Unique Users Today/#Unique users Over Last 30 days
    We have visit information stored in a table W_WEB_VISIT_F. For the sake of simplicity say it has columns VISIT_ID, VISIT_DATE and USER_ID (there are several more dimensional columns it has but I want to keep this exercise simple).
    I want to create an aggregate table called W_WEB_VISIT_A that pre-aggregates the three values I need per day: # Unique Users Today, #Unique users Over Last 7 days and #Unique users Over Last 30 days. The only way I can think of building the aggregate table is as follows
    WITH AGG AS (
    SELECT
    VISIT_DATE,
    USER_ID
    FROM W_WEB_VISIT_F
    GROUP BY
    VISIT_DATE,
    USER_ID
    select
    VISIT_DATE
    COUNT(DISTINCT USER_ID) UNIQUE_TODAY,
    (select count(distinct hist.USER_ID) from agg hist where hist.VISIT_DATE between src.VISIT_DATE - 6 and src.VISIT_DATE) SEVEN_DAYS,
    (select count(distinct hist.USER_ID) from agg hist where hist.VISIT_DATE between src.VISIT_DATE - 29 and src.VISIT_DATE) THIRTY_DAYS
    from agg
    group by visit_date
    The problem I am having is that W_WEB_VISIT_F has several million records in it and I can't get it the above query to complete. It ran over night and didn't complete.
    Is there a fancy 11g function I can use to do this for me? Is there a more efficient method?
    Thanks everyone for the help!
    -Joe
    Edited by: user9208525 on Jan 13, 2011 6:24 AM
    You guys are right. I missed the group by I had in the WITH Clause.

    Hi,
    Haven't used the windowing clause a lot, so I wanted to give a try.
    I made up some data with this query :create table t as select sysdate-dbms_random.value(0,10) visit_date, mod(level,5)+1 user_id
    from dual
    connect by level <= 20;Which gave me following rows :Scott@my10g SQL>select * from t order by visit_date;
    VISIT_DATE             USER_ID
    03/01/2011 13:17:10          1
    04/01/2011 05:30:30          4
    04/01/2011 08:08:13          5
    04/01/2011 14:42:24          3
    04/01/2011 20:20:58          3
    05/01/2011 17:29:24          2
    05/01/2011 17:40:20          4
    05/01/2011 18:32:56          2
    06/01/2011 04:12:53          5
    06/01/2011 08:59:18          2
    06/01/2011 09:04:26          3
    06/01/2011 10:14:20          1
    06/01/2011 14:22:54          1
    06/01/2011 19:39:04          1
    08/01/2011 14:44:18          5
    08/01/2011 21:38:04          5
    11/01/2011 04:56:05          4
    11/01/2011 18:52:29          2
    11/01/2011 23:57:30          4
    13/01/2011 07:24:22          3
    20 rows selected.I came up to that query :select
            v.*,
            case
                    when unq_l3d is null then -1
                    else trunc(unq_today/unq_l3d,2)
            end ratio
    from (
            select distinct trcdt, unq_today, unq_l3d
            from (
                    select
                    trcdt,
                    count(user_id)
                    over (
                            order by trcdt
                            range between numtodsinterval(1,'DAY') preceding and current row
                    ) unq_today,
                    count(user_id)
                    over (
                            order by trcdt
                            range between numtodsinterval(3,'DAY') preceding and current row
                    ) unq_l3d
                    from (
                            select distinct trunc(visit_date) trcdt, user_id from t
    ) v
    order by trcdtWith my sample data, it gives me :TRCDT                UNQ_TODAY    UNQ_L3D RATIO
    03/01/2011 00:00:00          1          1  1.00
    04/01/2011 00:00:00          4          4  1.00
    05/01/2011 00:00:00          5          6  0.83
    06/01/2011 00:00:00          6         10  0.60
    08/01/2011 00:00:00          1          7  0.14
    11/01/2011 00:00:00          2          3  0.66
    13/01/2011 00:00:00          1          3  0.33
    7 rows selected.where :
    - UNQ_TODAY is the number of distinct user_id in the day
    - UNQ_L3D is the number of distinct user_id in the last 3 days
    - RATIO is UNQ_TODAY divided by UNQ_L3D +(when UNQ_L3D is not zero)+
    It seems quite correct, but you would have to modify the query to fit to your needs and double-check the results !
    Just noticed that my query is all wrong*... must have been missing coffeine, or sleep.... but I'm still trying !
    Edited by: Nicosa on Jan 13, 2011 5:29 PM

  • Totals for Count Distinct

    I need to display totals for Count Distinct measures. I want to display these above a table view.
    We have done this before by creating hidden columns with level-based measures for totals and then displaying the first row of these hidden columns in a narrative view above the table. We have also used MAX(RSUM()) within requests, sometimes.
    These solutions won't work, because I need Count Distinct() measures (so simple sums and counts will give inaccurate results) and I may navigate to the request with filters at different levels (so LBMs won't work, either).
    The only solution I can think of is to have LBMs for each level and have duplicate dashboards that differ only in which variation of this request with which level's LBMs are displayed for the totals. That seems like too much of a kluge. There should be a simpler, better way to do this.

    I was trying to reproduce your issue with "Sample Sales" - but can't figure out which columns you'd like to see. Can you please post couple columns - and which count distinct you need? That would make it easier to reproduce the issue.
    I was thinking that it might be difficult to pull it in 1 report (since you can't completely exclude columns in table view). I have two suggestions:
    a) did you try to create a separate report and combine it with existing one (same Dashboard page)?
    b) did you try Pivot Table and its calculated column feature? I've had some success with it when I needed to combine measures at different levels on the same report (i needed to see daily totals for 3 specific days, monthly values for specific months, and couple annual totals). This way you could have it on the same report.
    I just tried A. And it worked (again, not sure if this is applicable to your situation). I used "Server Complex Aggregate" in column options. The formula is showing: SELECT "D5 Employee"."E01 Employee Name" saw_0, COUNT(DISTINCT "D1 Customer"."C1 Cust Name") saw_1 FROM "Sample Sales" ORDER BY saw_0
    Edited by: wildmight on Oct 30, 2009 9:35 AM

  • Count&Count Distinct

    Hi Gurus,
    In one of OBIEE blogs I studied "Aggregation should only be performed on measure columns, with the possible exception of the aggregation COUNT and Count Distinct"....my Question is what happens if we apply count&count distinct aggregation rules to measures because we are using that in our project,what are problems we will face?

    User wrote:
    you mean it executes a sub query internally to count and later it sum the result..correct.- You can ship the total calculations to the underlying RDBMS if 'Report Based Total' is not ticked, otherwise if it is, the BI Server computes the subtotal.
    and in your answers "No" mean results coming by putting sum in criteria are different ..right- Yes thats what I mean, sorry if unclear - Are your totals correct now? Failing that try 'server complex aggregate' but this is usually only requried if your deriving calculations in Answers (ie % of total etc).

  • Why oracle.exe is taking 8G virtual; bytes,  memroy target can not go beyond 5G. How to minimized the virtual byte in perfmon

    Dear Experts,
    Please help me in checking why virtual bytes in perfmon is taking more than memory we allocated.
    OS
    Windows Server 2003 R2 Enterprise x64 Edition Service Pack 2 (build 3790)
    ORACLE
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 64-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    Total RAM on box is 8G
    Page File
    Windows virtual memory equal on C,D,E,F drives is set to  12273M and allocated now is 11262M
    LPENABLED is not set
    SQL> show parameter pga_
    pga_aggregate_target   0
    SQL> show sga
    Total System Global Area 5344731136 bytes
    Fixed Size                  2114736 bytes
    Variable Size            4630514512 bytes
    Database Buffers          671088640 bytes
    Redo Buffers               41013248 bytes
    SQL> show parameter memory
    hi_shared_memory_address  0      
    memory_max_target    5G                
    memory_target      5G                  
    shared_memory_address  0             
    SQL> show parameter sga
    lock_sga   FALSE                         
    pre_page_sga     FALSE                   
    sga_max_size   5G                     
    sga_target      0
    Question :
    Why oracle.exe is taking 8G virtual; bytes,  memroy target can not go beyond 5G. How to minimized the virtual byte in perfmon
    Thanks in advance your time and help.

    John, Thanks for the reply.
    Please find the output of query
    SQL> select pool,sum(bytes) from v$sgastat group by pool;
    POOL         SUM(BYTES)
                  915543216
    java pool      67108864
    streams pool  268503944
    shared pool  2147494008
    large pool     67108864
    SQL>
    SQL> select * from v$pgastat;
    NAME                                                                  VALUE UNIT
    aggregate PGA target parameter                                    671088640 bytes
    aggregate PGA auto target                                         147564544 bytes
    global memory bound                                               104857600 bytes
    total PGA inuse                                                   533962752 bytes
    total PGA allocated                                               810819584 bytes
    maximum PGA allocated                                            1244466176 bytes
    total freeable PGA memory                                          90243072 bytes
    process count                                                           450
    max processes count                                                     588
    PGA memory freed back to OS                                      1.9883E+10 bytes
    total PGA used for auto workareas                                  28210176 bytes
    maximum PGA used for auto workareas                                39973888 bytes
    total PGA used for manual workareas                                       0 bytes
    maximum PGA used for manual workareas                                531456 bytes
    over allocation count                                                     7
    bytes processed                                                  2.6307E+10 bytes
    extra bytes read/written                                                  0 bytes
    cache hit percentage                                                    100 percent
    recompute count (total)                                               72720
    19 rows selected.
    SQL>
    SQL>  show parameter _target
    NAME                                 TYPE                             VALUE
    archive_lag_target                   integer                          0
    db_flashback_retention_target        integer                          1440
    fast_start_io_target                 integer                          0
    fast_start_mttr_target               integer                          0
    memory_max_target                    big integer                      5G
    memory_target                        big integer                      5G
    pga_aggregate_target                 big integer                      0
    sga_target                           big integer                      0
    SQL> sho parameter sga_max
    NAME                                 TYPE                             VALUE
    sga_max_size                         big integer                      5G

  • Grand Total on Count Distinct - Crosstab

    Hello
    I use Discoverer 9.0.2.39.01.
    On a crosstab layout: the data point is a count distinct item ,
    I use Grand total at bottom and also Grand total at right.
    Both totals are displayed correct but the cell combining between them is blank.
    The join between the two tables is one to one and I use NVL on the count distinct item. how can I overcome the problem and cuase th blank cell to display the result of both totals?

    I'd just reiterate a couple of things to try.
    1. reverse the join - I realize you mentioned it seems to work for simple total, but this has to be one of the most popular errors
    2. check for NULLs in the data (ie: to_number(NVL(item, '0')), etc.
    If still not working, then logically, what would be causing a count of distinct items not to display (ie: NULL would explain it as I would think the COUNT would screw up with not knowing how to handle a NULL).
    By why count(item) would work and count_distinct(item) wouldn't is an interesting problem.
    Russ

Maybe you are looking for

  • File content conversion Document offset not working?

    hi All, I have a flat file which i need to convert into an xml using content conversion. The document consists of 18 lines as shown below:- #HEADER_ARCDLX3098   OMD.I.170 0000000000000002#HEADERFECHADOC A 8 HEADER A 25 CLAMOVIM A 3 MOTIVMOV N 4 CENTR

  • Function module/BAPI for executing VD51/VD52 transactions

    Hi Warm greetings to all, I require a function module/BAPI for executing VD51/VD52 transactions. Can anyone help on this Sreekanth

  • Error in enhanced receiver determination

    Hi Experts, I am trying to implement a scenario in which  i have to get the receivers at run time by doing a  lookup to a file which stores the destinations. i am getting the error that no receivers could be determined. thanks, Anika

  • Iphone not active

    i have iphone 3gs and i forget my passcod for screen so i was update iphone maybe find solution but itunes said this iphone not active please help

  • 2010 iMac 21.5 won't boot up , froze at white screen! HELP!

    Hi, everyone I need help! This morning the batteries ran out in my wireless magic mouse so I put in new batteries... Then all of a sudden by computer began to freeze and the colorful pin wheel began to spin and it was unresponsive! As my mouse couldn