Generating Derived Table

Hi,
I've just created in BO Designer 6.5 a derived table for the calculation of an aggregate function.
The table is structured in the following way (for example):
SELECT SUM(ColumnCount) AS Sum_Distinct_NDG
FROM (SELECT COUNT(DISTINCT cod_sample) AS ColumnCount
           FROM table.sample) DTBL
In the derived table I have only one numeric column, and I can not put it in join with my fact table (table.sample).
I thought topopulate the derived table also with an "alias" of the "table.sample.cod_sample" to put them in join, am I right? Anyway... I don't know how to do it.
Can anybody help me to go on?
Thanks in advance
Riccardo

Hi riccardo,
assuming you have a table A with a column A1 and you want to count the distinct entries in this column. Your sql statement will look like this:
select count(distinct A.A1) from A
Assuming that the column A1 contains the following data:
A1
1
1
2
2
3
Your sql statement return only one row with just one column:
select count(distinct A.A1) from A
3
In your example you try then to build the sum of a table with a single line:
select sum(B.alias1) from ( select count(distinct A.A1) as alias1 from A ) B
which does not make really sense. 
Generally it does not make sense to apply two aggregation operators on the same database field at once.
What is your high level requirement here? In order to count the distinct entries the distinct count operator should be enough.
Regards,
Stratos

Similar Messages

  • Can we create prompts in Derived Table sql query

    Hi,
    I am trying to define derived table sql query as below. Though the syntax parsing is going through but when I am generating the report it is throwing and invalid prompt definition error.
    " select * from table_a where call_direction = @Prompt('Enter Call Direction','A','"derivedtable_a".SHORT_STRING',mono,free,not_persistent,) and
    where call_type = @Prompt('Enter Call Direction','A','"derivedtable_b".SHORT_STRING',mono,free,not_persistent,) "
    Can somebody please share your thoughts if this can be achieved in universe or not ?
    Appreciate immediate responses as it is a show stopper for my deliverable.
    Thanks in advance.
    Thanks and Regards,
    Shireen.

    Hi Shireen
    We can use prompt in the derived table. There is issue with the SQL that you have used while creating the Derived Table.
    Instead of using the "derivedtable_a".SHORT_STRING' field use the object from the class on which you are creating the derived table.
    For example: If you are creating a derived table in the sample universe efashion on Agg_yr_qt_rn_st_ln_ca_sr table then use the following query:
    SELECT *
    FROM Agg_yr_qt_rn_st_ln_ca_sr
    WHERE Agg_yr_qt_rn_st_ln_ca_sr.Yr = @Prompt ('Enter Value','C','Time Period\Year',mono,constrained)
    Hope this helps!
    Thanks

  • IDT 4.1 - Derived Table Question

    Hello,
    I working on a project and I have hit a road block,  need your help...
    Scenario:  We have a Derived Table with multiple @prompts and I need to make this optional so that if the user does not answer any of the prompts the query should bring back results.  But I tried already tried using 'optional' in the @prompt syntax like below, this makes the prompts NOT mandatory but when user does not answer these prompts we DON'T get any results...
    @Prompt('Parameter Name','A',LOV,Multi,Constrained,Not_Persistent,,optional)
    Any ideas and thoughts are welcome !!
    Warm Regards,
    Manohar Singh

    This is how I I would go about debugging the issue, then.
    I would temporarily pull the result of the prompt into a column of the derived table (we'll call it derived table A), and then add a dimension which displays the value of that column. 
    Then I would add some sort of outer join (which generates a Cartesian product perhaps -- doesn't matter for debugging, though you may want to choose a small table!) between derived table A and another table (we'll call it 'table B').  Then create another dimension on 'table B'.
    Then I would run a query using the dimension from derived table A and the dimension from table B.  The outer join should always give a result and allow you to see what BO is actually substituting for the empty prompt value. 
    If you transform the empty prompt value somehow in one of your subqueries, you could take the transformed value and turn it into another dimension on derived table A.  Take it one step at a time this way and you'll eventually understand how the pieces are being put together.
    Good luck!

  • How do I use Derived Table to dynamically choose fact table

    How do I use the Derived Table functionality to dynamically choose a fact table?
    I am using BO XI R2 querying against Genesys Datamart kept in Oracle 10g.  The datamart contains aggregated fact tables at different levels (no_agg, hour, day, week, etc...) I would like to build my universe so that if the end user chooses a parameter to view reports at daily granularity, then the daily fact table is used;  choose hourly granularity, then hourly fact table is used, etc....
    I tried using dynamic SQL in Oracle Syntax, but Business Obljects Universe didn't like that type of coding.
    The tables look something like this:
    O_LOB1_NO_AGG o
    inner join V_LOB1_NO_AGG v on o.object_id = v.object_id
    inner join T_LOB1_NO_AGG t on v.timekey = t.timekey
    Likewise, in the 'hour', 'day', 'week', etc... fact tables, the Primary Key to Foreign Key names and relationships are the same.  And the columns in each O_, V_, T_ fact table is the same, or very similar (just aggregated at different levels of time).
    I was thinking of going a different route and using aggregate aware; but there are many Lines of Business (20+) and multiple time dimensions (7) and I believe aggregate aware would require me to place all relevant tables in the Universe as separate objects, which would create a large Universe with multiple table objects,  and not be maintenance-friendly. I also was going to dynamically choose Line of Business (LOB) in the derived tables, based on the end user choosing a parameter for LOB, but that is out-of-scope for my current question.  But that information sort of points you down the train of thought I am travelling. Thanks for any help you can provide!

    You can create a derived table containing a union like the following:
    select a,b,c from DailyFacts where (@prompt('View'....) = 'Daily' and (<rest of your where conditions here if necessary>)
    union
    (select a,b,c from MonthlyFacts where (@prompt('View'....) = 'Monthly' and (<rest of your where conditions here if necessary>))
    union
    (select a,b,c from YearlyFacts where (@prompt('View'....) = 'Yearly' and (<rest of your where conditions here if necessary>))
    I assume that you are familiar with the @prompt syntax
    Regards,
    Stratos

  • Problem with WebIntelligence and Universe Designer Derived Table

    Hi people, i have an issue with a report in WebIntelligence that i want to build. Here it goes:
    I created a derived table that brings every material that has or not any movement. The thing is that when I build the report using other information like Material Name, for example. The report filters by the coincidence between materials in the derived table and the SAP Standard table. I tried to modify the SQL query but, Oracle does not allow it.
    So here are my questions:
    1)Is any way to do a Left outer join in order to have any single material and do not allow WebIntelligence to do Inline views?
    2)Do i have to modify the derived table? and use the standard tables?
    3)Can i work with a derived table that does not have any join with the standard tables?
    Thanks in advance,
    Reynaldo

    If I understand you correctly, it sounds like you are getting an inner join where you want an outer join? You have several options:
    1. You can do an outer join in the universe, or even embedded in your derived table (if that is what you are trying to do)
    2. You can have a derived table that is not joined with any other tables in the Universe. But you will have to merge the dimensions in the Webi report, and then be sure to put the correct dimension(s) on the report in order to reflect the outer join you want.
    I hope that helps.

  • VLD-1119: Unable to generate Multi-table Insert statement for some or all t

    Hi All -
    I have a map in OWB 10.2.0.4 which is ending with following error: -
    VLD-1119: Unable to generate Multi-table Insert statement for some or all targets.*
    Multi-table insert statement cannot be generated for some or all of the targets due to upstream graphs of those targets are not identical on "active operators" such as "join".*
    The map is created with following logic in mind. Let me know if you need more info. Any directions are highly appreciated and many thanks for your inputs in advance: -
    I have two source tables say T1 and T2. There are full outer joined in a joiner and output of this joined is passed to an expression to evaluate values of columns based on
    business logic i.e. If T1 is available than take T1.C1 else take T2.C1 so on.
    A flag is also evaluated in the expression because these intermediate results needs to be joined to third source table say T3 with different condition.
    Based on value taken a flag is being set in the expression which is used in a splitter to get results in three intermediate tables based on flag value evaluated earlier.
    These three intermediate tables are all truncate insert and these are unioned to fill a final target table.
    Visually it is something like this: -
    T1 -- T3 -- JOINER1
    | -->Join1 (FULL OUTER) --> Expression -->SPLITTER -- JOINER2 UNION --> Target Table
    | JOINER3
    T2 --
    Please suggest.

    I verified that their is a limitation with the splitter operator which will not let you generate a multi split having more than 999 columns in all.
    I had to use two separate splitters to achieve what I was trying to do.
    So the situation is now: -
    Siource -> Split -> Split 1 -> Insert into table -> Union1---------Final tableA
    Siource -> Split -> Split 2 -> Insert into table -> Union1

  • How to process each records in the derived table which i created using cte table using sql server

    I want to process each row from the CTE table I created, how can I traverse from first row to second row and so on....
    how to process each records in the derived table which i created using  cte table using sql server

    Ideally you would be doing a set based processing rather than traversing row by row as thats more efficient. To answer it specific to your scenario we may need more info. Can you explain with some sample data your exact requirement?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Help needed in Derived Table

    Dear Experts,
    Can anyone tell me in which scenario we will go for derived table?  We are creating a report on top of a Cube,
    Thanks,
    Kind Regards,
    Sathish Kumar.N

    Hi Sathish,
    Hope this helps:
    http://scn.sap.com/thread/2019524
    http://www.forumtopics.com/busobj/viewtopic.php?p=684054&sid=13e89b7f7b9e97d6921e9899023e3929
    http://www.forumtopics.com/busobj/viewtopic.php?p=770433&sid=1f947ce435f0c0b96ebed248a1c908a0
    regards,
    M

  • CASE Statement is not working Derived table

    Hi All,
    in the bello SQL Statement case statement is not working in derived table. I am new to creation of derived table if any body knows plz kinldy help me out on this.
    SELECT x.market, x.droprate as med1
    FROM
    (select upper(market_name) as market, fulldate as date_value,
         (sum([Dy_LOT_DROPS_N][Dy_OB_HO_DROPS][Dy_NonRF_Drop]))/
              nullif(sum(CASE WHEN (month(BBHDLY.FullDate)}>= 6 and { year(BBHDLY.FullDate)} = 2011) or {fn year(IDENSLABBHDLY.FullDate)} > 2011
    THEN  BBHDLY.Dy_Calls - BBHDLY.Dy_HO_CHAN_ALLOC ELSE BBHDLY.Dy_Calls END),0)*100 as droprate
    from BBHDLY sla
    inner join Dim mkt
         on sla.bts_name = mkt.bts_name and sla.SectorID = mkt.Sector_Id
                   where fulldate >= GETDATE()-46
                   group by market_name, fulldate) x,
    (select market_name as market, fulldate as date_value,
    (sum([Dy_LOT_DROPS_N][Dy_OB_HO_DROPS][Dy_NonRF_Drop]))/
              nullif(sum(CASE WHEN ({fn month(BBHDLY.FullDate)}>= 6 and {fn year(BBHDLY.FullDate)} = 2011) or {fn year(BBHDLY.FullDate)} >
    2011 THEN  BBHDLY.Dy_Calls - BBHDLY.Dy_HO_CHAN_ALLOC ELSE BBHDLY.Dy_Calls END),0)*100 as droprate
    from BBHDLY sla
    inner join Dim mkt
         on sla.bts_name = mkt.bts_name and sla.SectorID = mkt.Sector_Id
                   where fulldate >=GETDATE()-46
                   group by market_name, fulldate) y
    where x.market = y.market
    GROUP BY x.droprate, x.market
    HAVING
       SUM(CASE WHEN y.droprate <= x.droprate
          THEN 1 ELSE 0 END)>=(COUNT(*)+1)/2 AND
       SUM(CASE WHEN y.droprate >= x.droprate
          THEN 1 ELSE 0 END)>=(COUNT(*)/2)+1
    Thanks

    It looks like SQL Server or Sybase given that you're using getdate().
    As such, Vinesh's comment to use decode is wrong - decode is  Oracle syntax.
    Looking at your statement again, I've noticed the following:
    you have no { to match the first } - not sure why you're using them anyway.
    you haven't given x.market a name - use x.market as market instead
    use coalesce instead of nullif if you're on SQL Server.

  • How can I generate a table of contents from bookmarks

    How can I generate a Table of Contents from bookmarks in Adobe Acrobat XI?

    Something to try.
    Rick Bostein  provided a "Create Bookmark Report" Acrobat Action.
    With this report as a PDF you could insert it at the start of your PDF document to serve as a "TOC". 
    Go here:
    https://acrobatusers.com/actions-exchange 
    Scroll down some.
    Be well...

  • I cannot generate a table of contents in INDesign3

    Hi There:
    I'm fairly new to Indesign CS3 and I need to generate a table of contents. I created a book file which consists of 20 chapters. I also created a Frontmatter file, which is also part of the book file. According to the help menu, I should open up the FM file and choose, LAYOUT>TABLE OF CONTENTS to begin. However this option under layout doesn't exist. Is there a plug-in I am missing. HELP! I need to generate this TOC at some point today.
    thanks much to whomever can help.
    -Lisa

    As far as I know, it should be there always unless the menus themselves have been turned off by someone. Might as well check though.
    1) GO to Edit > Menus (opens Menu Customization)
    2) Select Application Menus from the Category field
    3) Expand "Layout" under Application Menu Command and make sure the Visibility icon is active for the TOC items (at bottom)
    edit: Of course you could also go to Window > Workspace and select reset menus

  • Can you generate a Table of Contents using bookmarks?

    Hi,
    I am a newbie to InDesign and am probably missing the obvious but...
    I am creating a document in InDesign and want to generate a Table of Contents. I have just created a de facto ToC with Bookmarks for the exported PDF version of the file, but there seems to be no way to take this information and use it to creat an actual ToC in the ID file itself. My bookmark list contains the information for all the chapter and sub headings along with the page locations, all the data I need to create my ToC, but I can't find a way to do this. I don't understand why I have to use paragraph styles to set this up? It is overly complicated for my needs, added to that it is duplicating my work. If I have to set up paragraph styles for the print version and bookmarks for the PDF version, why can't one set of information be used to generate both version of a Toc?

    You don't consider 100 pages a long doc? Ouch. If it needs a TOC, I'd say that's pretty definitive for it being long.
    I know users who set up styles for even one-page projects. I figure it's worth setting up a style for any formatting that will repeat more than twice, regardless of document length. It's pretty fast using the format/select/define style method  of formatting text the way you want, then selecting it and choosing "New Style" from the appropriate panel.

  • Adding derived table  to-Universe issue!

    Hi,
    I am trying to add a derived table to my Universe by writing a SQL query, after some length of the query its not enabling me to write more.Could soemebody suggest is there any limit I can write upto or is there anyway I can increase the capacity of the length of the query.Thanks in Advance.

    How big is your query. I think there is a limit based on the edit box of about 32k but that is all
    It is possible to create derived tables based on other derived table using the @DerivedTable function. You might be able to break your query into smaller parts and build it that way
    Regards
    Alan

  • Reference a Derived table in another Derived Table

    Is it possible to reference a derived table from another derived table? I am using Business Object XI 3.0.

    This is not possible as the Designer wants physical tables...
    What you could do is create the second derived table as follows:
    SELECT     table1.col1,
         table1.col2,
         table2.col1,
         table2.col2
    FROM     table1,
         (SELECT col1,
              col2
         FROM     atable) table2
    Regards
    Jacques

  • Derived Table creation

    Hi, we are working on Business Objects Migration 6.1 to BOXIR2 project.plz any one help me Derived table creation for Free Hand SQL Reports?.How to use promt functions also.........?
    Thanks for advance....
    Thanks&Regards
    Ramu

    Ramu,
    Your question is posted in the General forum, but I think you might want to close this entry and re-post in one of the two following forums:
    Web Intelligence
    [SAP BusinessObjects Web Intelligence;
    Universe Designer & Business Views Designer
    [Semantic Layer;
    Thanks,
    John

Maybe you are looking for

  • Endpoints not published in Service Registry

    Hi all, I have published all the Enterprise services from the Discovery system(ECC) and they are available within the service registry. But somehow the endpoints are not published to the Service Registry because of which I am not able to consume the

  • Webi does not pick correct Data

    Hi Guys, I have a webi. The Universe for the Webi is based on  Bex Query. I see correct Data in Bex Query but when I create a webi report it does not pick correct data. I have checked following points already:- 1] No Resstriction at Query Level 2] No

  • SFTP- permission issue

    Hi SuperSAs, I have one issue with SFTP, one of our user complaint me that whenever he create a directory by using his SFTP id the permission set to 750. He requested me to set his permission to 770. i checked his profile and found that umask is alre

  • Help please hard drives

    Can I take the hard drive from a c655 s5503 and put it in a a505 s6033? The hard drive on my laptop is crashed and my sons laptop keeps coming apart so my son

  • Can Lightroom 3 or 4 be updated still? I just purchased a Nikon d800 but the Raw files will not import using a MAC

    As above shows, I might be in the wrong place to ask here? But can any one give me leads to this issue or can anyone share if they had the same issue.