Matrix Report with Fill Zero

Hello ,
I created a matrix report , Outer join is using in query ,so couldn't fill "0" to blank ammount column , please help me
Query is :-
SELECT
nvl(AAMT,0) AAMT,
nvl(AHRS,0) AHRS,
JOBNUM JOBNO,
B.USERCCM,
B.CCMNAME
FROM
(SELECT SUM(ACTAMT) AAMT,
SUM(ACTHRS) AHRS,
JOBNUM,
CCM,
DEPTCODE FROM
(SELECT SUM( ACTAMT) ACTAMT,
SUM(ACTHRS) ACTHRS,
JOBNUM,
CCM,
DEPTCODE
FROM CSBUDTIM
WHERE DEPTCODE=:DEPTCOD AND
JOBNUM BETWEEN :JOBNUM AND :JOBNUM1 AND
TRDATE BETWEEN :FROMDATE AND :TODATE
GROUP BY JOBNUM,CCM,DEPTCODE
UNION ALL
SELECT SUM( ACTAMT) ACTAMT,
SUM(ACTHRS) ACTHRS,
JOBNUM,
CCM,
DEPTCODE
FROM CSBUDETM
WHERE DEPTCODE=:DEPTCOD AND
JOBNUM BETWEEN :JOBNUM AND :JOBNUM1 AND
TRDATE BETWEEN :FROMDATE AND :TODATE
GROUP BY JOBNUM,CCM,DEPTCODE
UNION ALL
SELECT SUM(ACTAMT) ACTAMT,
0 ACTHRS,
JOBNUM,
NVL(CCM,'DM') CCM,
DEPTCODE
FROM CSBUDMAT
WHERE DEPTCODE=:DEPTCOD AND
JOBNUM BETWEEN :JOBNUM AND :JOBNUM1 AND
TRDATE BETWEEN :FROMDATE AND :TODATE
GROUP BY JOBNUM,CCM,DEPTCODE)
GROUP BY JOBNUM,CCM,DEPTCODE) A ,
CSPGMCCM B
WHERE B.DEPTCODE = A.DEPTCODE(+) AND
B.USERCCM = A.CCM(+) and
B.DEPTCODE = :DEPTCOD
ORDER BY A.JOBNUM,B.USERCCM
--------------------------------------------------------------------------------

Hay Thahir,
Can u plz tell me the solution

Similar Messages

  • Matrix report with group.

    dear all,
    can anyone guide me how to build a matrix report with group using scott schema.
    i can not be able to build a query.
    Thanks
    Muhammad Nadeem

    The example given by Oracle (from the above link) using the following SQL for a matrix report is flawed.
    SELECT DEPTNO, JOB, SUM(SAL)
    FROM EMP
    GROUP BY DEPTNO, JOB
    ORDER BY DEPTNO, JOB
    The SUM function handled by the query restricts you from doing so many things - especially when you want the empty fields to be filled by 0 (by using the Value if Null property).
    If the query is changed to ''SELECT DEPTNO, JOB, SAL FROM EMP' , and use the SUM function in the wizard to build the Matrix cell, then the 'Value if Null' property can be used without any issues.
    This also makes Section 25.6 (Add zeroes in place of blanks) of the documentation a joke.
    Anyway, that's my cents worth....

  • Tree Matrix Report with double line heading

    Hi,
    I am very new to HTML-DB and HTML as well.
    I need to create a matrix report with a tree functionality and with two line heading.
    Basically This is what I need to generate
    REGION1 REGION2 REGION3
    COL1 COL2 TOTAL COL1 COL2 TOTAL COL1 COL2 TOTAL
    ===========================================================
    CAT1+
    Sub_CAT1
    Sub_CAT2
    CAT2+
    Sub_SCAT3
    Sub_SCAT4
    Where CAT1 , CAT2 needs to be collapsible rows. SCAT1..SCAT4 are sub categories under main categories.
    REGION1.... REGION3 are top level headings. And COL1,COL2 are sub headings under top level headings.
    Thanks,
    Shri

    Please help me on this!
    Thanks,
    Shri

  • Matrix report with two across groups

    Hi all,
    I am facing a problem in making a multi line matrix report.
    actually I need to make a matrix report with two "across groups", but unable to get desired result.
    if any body has any idea, please share with me.
    regards
    Ata

    No,
    you must have only 1 query which extracts all your data:
    A,q1,10
    A,q2,20
    A,q3,30
    B,q1,40
    B,q3,50
    C,q2,60
    C,q3,70
    Open report builder and create a new report from wizard.
    Select the first option accordingly with your requirements and go next.
    Type a name for your report in the title field then select "Matrix" as layout and go next.
    Select SQL Query and go next.
    Type your query.
    Select the data you want on the rows (i.e. A, B, C...) and click on the ">" button in the Matrix Row Fields section, then go next.
    Select the data you want on the columns (i.e. q1, q2, q3...) and click on the ">" button in the Matrix Column Fields section, then go next.
    Select the data you want on the cells(i.e. 10,20,30...) and click on the "Sum >" button in the Matrix Cell Fields section, then go next.
    Add some totals, if you need them.
    Go next and finish.
    Now you have a report with the following layout:
             Q1           Q2            Q3       TOT
    A        10           20            30        60
    B        40                         50        90
    C                     60            70       130
    TOT      50           80           150       280Bye
    Raffy

  • Group matrix report with an hierarchy table???

    Hello,
    I have a big trouble making up a report involving many tables and one of them having a many-to-many recursive relationship. The user has a defined request in having the information grouped.I'll give some more details. I would like to know if you have any ideas in how to structure the report..
    Here are the tables:
    ORG
    (org_id not null,
    org_name not null)
    DNR
    (dnr_id not null,
    org_id not null,
    dnr_age,
    dnr_gender)
    CS
    (cs_id not null,
    dnr_id not null)
    Smpl
    (smpl_id not null,
    dnr_id notnull,
    org_id,
    smpl_tp not null,
    cs_id,
    meth,
    notes)
    Tr_map
    (tr_id not null,
    smpl_prnt not null,
    smpl_chld,
    pos)
    Some data..
    Smpl_id Dnr_id Org_id Smpl_tp Cs_id Meth Notes
    107 101 137 tss a xxxx
    118 112 137 tss ab xxxx
    122 108 25 tss 3768 a xxxx
    123 108 25 tss 3768 ab xxxx
    124 108 25 blk c yyyy
    125 108 25 sld d zzzz
    126 108 25 blk c yyyy
    tr_id Smpl_prnt Smpl_chld Pos
    1 107
    2 118
    3 122
    4 123
    5 124 122 1
    7 125 124 1
    8 126 122 1
    10 125 126 2
    The user wants the data reported as follows:
    Org name
    Dnr_id, dnr_age etc...
    Cs_id
    Smpl_id, Smpl_tp (tss), Meth, Notes
    Smpl_id,smpl_tp(blk), Meth, Notes ...
    Smpl_id, smpl_tp(sld), Meth, Notes...
    Cs_id
    Smpl_id, Smpl_tp (tss), Meth, Notes
    Smpl_id, smpl_tp(blk), Meth,Notes...
    Smpl_id, smpl_tp(sld), Meth, Notes...
    I think the grouped matrix would be the solution but I don't know how to do that with the hierarchy table to show the children and grandchildren as subgroups. Is that possible in a single query? How can I build a group matrix with multiple subgroups?
    Thanks in advance.
    simona
    null

    The example given by Oracle (from the above link) using the following SQL for a matrix report is flawed.
    SELECT DEPTNO, JOB, SUM(SAL)
    FROM EMP
    GROUP BY DEPTNO, JOB
    ORDER BY DEPTNO, JOB
    The SUM function handled by the query restricts you from doing so many things - especially when you want the empty fields to be filled by 0 (by using the Value if Null property).
    If the query is changed to ''SELECT DEPTNO, JOB, SAL FROM EMP' , and use the SUM function in the wizard to build the Matrix cell, then the 'Value if Null' property can be used without any issues.
    This also makes Section 25.6 (Add zeroes in place of blanks) of the documentation a joke.
    Anyway, that's my cents worth....

  • Matrix report with dynamic and fixed columns

    Hi all,
    I have a matrix report which has dynamic as well as few fixed columns.
    It is a fixed asset Report in which the sum(cost) in cell should be grouped according to column and row-wise.
    The row consists of the activity such as additions, retirements etc and the dynamic column is the category and other fixed columns such as CIP cost, CWIP cost will be grouped only according to row.
    the actual layout should be like this
                     | category 1 | category 2 | category 3 ...... | CIP cost | CWIP cost
    Additions    | Sum(cost) | Sum(cost)  | Sum(cost)  .......| 1234      | 4500
    retirements | Sum(cost) | Sum(cost)  | Sum(cost)  .......| 1000      | 2500but due to fixed colums in the layout the report builder pushes the fixed colums to the next row with single query i get
                     | category 1 | category 2 | category 3 ...... |
    Additions    | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
                      CIP cost     | CWIP cost
                       1234        | 4500
    retirements | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
                      CIP cost     | CWIP cost
                       1000        | 2500if i try to add those columns alone in a seperate query and then build the report i get the layout like this
                     | category 1 | category 2 | category 3 ...... |
    Additions    | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
    retirements | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
    CIP cost     | CWIP cost
    2234        | 7000This is my query, i have used union to get the row-wise column activity
    /* Formatted on 03-Sep-12 5:23:11 PM (QP5 v5.114.809.3010) */
      SELECT   DISTINCT /*ASSET_ID
                        SUM (cost),
                        SUM (cip_cost),
                        SUM (cip_cost_pk),
                        cat_desc--,sub_cat_desc
                        ,activity
        FROM   (-- cip cost
                SELECT   DISTINCT asset_id,
                                  cost,
                                  ytd_deprn,
                                  deprn_amount,
                                  deprn_reserve acc_deprn,
                                  cost - deprn_reserve net_bk_val,
                                  cip_cost,
                                  cip_cost_pk,
                                  description cat_desc,
                                  fat_desc sub_cat_desc,
                                  activity
                  FROM   (SELECT   DISTINCT
                                   fb.asset_id,
                                   fb.cost,
                                   facc.cost cip_cost,
                                   0 cip_cost_pk,
                                   ds.ytd_deprn,
                                   ds.deprn_reserve,
                                   fc.description,
                                   fat.description fat_desc,
                                   ds.deprn_amount,
                                   DECODE (
                                         facc.asset_type
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || di.transtype,
                                         'CIP'
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || 'TRANSFER',
                                      'CIP T/F',
                                      'CIP-0012-' || di.transtype,
                                      'Additions Project Khalifa assets',
                                      'CAPITALIZED-' || fc.segment1 || di.transtype,
                                      '0',
                                      'Additions'
                                      activity
                            FROM   fa_books fb,
                                   fa_additions_b fa,
                                   fa_methods fm,
                                   fa_financial_inquiry_cost_v fic,
                                   fa_categories_vl fc,
                                   fa_capitalize_cip_v facc,
                                   fa_additions_tl fat,
                                   fa_deprn_summary ds,
                                   fa_distribution_inquiry_v di
                           WHERE       ds.asset_id = fa.asset_id
                                   AND fb.asset_id = fa.asset_id
                                   AND fb.asset_id = fic.asset_id
                                   AND di.asset_id = fb.asset_id
                                   AND fb.life_in_months = fm.life_in_months
                                   AND fb.book_type_code = ds.book_type_code
                                   AND fb.book_type_code = fic.book_type_code
                                   AND fa.last_update_date >
                                         TO_DATE (
                                               '01'
                                            || 'JAN'
                                            || TO_CHAR (SYSDATE, 'RRRR'),
                                            'DD-MON-RRRR'
                                   AND ds.deprn_run_date =
                                         (SELECT   DISTINCT MAX (deprn_run_date)
                                            FROM   fa_deprn_summary
                                           WHERE   asset_id = fb.asset_id)
                                   AND fic.transaction_header_id_in =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id_in)
                                            FROM   fa_financial_inquiry_cost_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fb.date_effective =
                                         (SELECT   DISTINCT MAX (date_effective)
                                            FROM   fa_books
                                           WHERE   asset_id = fb.asset_id)
                                   AND di.transaction_header_id =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id)
                                            FROM   fa_distribution_inquiry_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fa.attribute_category_code =
                                         fc.segment1 || '-' || fc.segment2
                                   AND fc.segment1 <> '0012'
                                   AND fb.asset_id = facc.asset_id
                                   AND fa.asset_id = fat.asset_id
                                   --AND facc.asset_type <> 'CAPITALIZED'
                                   AND fb.deprn_method_code = fm.method_code
                                   AND ds.deprn_source_code <> 'BOOKS'
                                   AND DECODE (
                                         facc.asset_type || '-' || fc.segment1,
                                         'CIP-0012',
                                         'Additions Project Khalifa assets',
                                         'CAPITALIZED-' || fc.segment1,
                                         '0',
                                         'Additions'
                                      ) <> '0'/*ORDER BY fb.asset_id*/
                UNION
                --cip cost pk
                SELECT   DISTINCT asset_id,
                                  cost,
                                  ytd_deprn,
                                  deprn_amount,
                                  deprn_reserve acc_deprn,
                                  cost - deprn_reserve net_bk_val,
                                  cip_cost,
                                  cip_cost_pk,
                                  description cat_desc,
                                  fat_desc sub_cat_desc,
                                  activity
                  FROM   (SELECT   DISTINCT
                                   fb.asset_id,
                                   fb.cost,
                                   0 cip_cost,
                                   facc.cost cip_cost_pk,
                                   ds.ytd_deprn,
                                   ds.deprn_reserve,
                                   fc.description,
                                   fat.description fat_desc,
                                   ds.deprn_amount,
                                   DECODE (
                                         facc.asset_type
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || di.transtype,
                                         'CIP'
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || 'TRANSFER',
                                      'CIP T/F',
                                      'CIP-0012-' || di.transtype,
                                      'Additions Project Khalifa assets',
                                      'CAPITALIZED-' || fc.segment1 || di.transtype,
                                      '0',
                                      'Additions'
                                      activity
                            FROM   fa_books fb,
                                   fa_additions_b fa,
                                   fa_methods fm,
                                   fa_financial_inquiry_cost_v fic,
                                   fa_categories_vl fc,
                                   fa_capitalize_cip_v facc,
                                   fa_additions_tl fat,
                                   fa_deprn_summary ds,
                                   fa_distribution_inquiry_v di
                           WHERE       ds.asset_id = fa.asset_id
                                   AND fb.asset_id = fa.asset_id
                                   AND fb.asset_id = fic.asset_id
                                   AND di.asset_id = fb.asset_id
                                   AND fb.life_in_months = fm.life_in_months
                                   AND fb.book_type_code = ds.book_type_code
                                   AND fb.book_type_code = fic.book_type_code
                                   AND fa.last_update_date >
                                         TO_DATE (
                                               '01'
                                            || 'JAN'
                                            || TO_CHAR (SYSDATE, 'RRRR'),
                                            'DD-MON-RRRR'
                                   AND ds.deprn_run_date =
                                         (SELECT   DISTINCT MAX (deprn_run_date)
                                            FROM   fa_deprn_summary
                                           WHERE   asset_id = fb.asset_id)
                                   AND fic.transaction_header_id_in =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id_in)
                                            FROM   fa_financial_inquiry_cost_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fb.date_effective =
                                         (SELECT   DISTINCT MAX (date_effective)
                                            FROM   fa_books
                                           WHERE   asset_id = fb.asset_id)
                                   AND di.transaction_header_id =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id)
                                            FROM   fa_distribution_inquiry_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fa.attribute_category_code =
                                         fc.segment1 || '-' || fc.segment2
                                   AND fc.segment1 = '0012'
                                   AND fb.asset_id = facc.asset_id
                                   AND fa.asset_id = fat.asset_id
                                   --AND facc.asset_type <> 'CAPITALIZED'
                                   AND fb.deprn_method_code = fm.method_code
                                   AND ds.deprn_source_code <> 'BOOKS'
                                   AND DECODE (
                                         facc.asset_type || '-' || fc.segment1,
                                         'CIP-0012',
                                         'Additions Project Khalifa assets',
                                         'CAPITALIZED-' || fc.segment1,
                                         '0',
                                         'Additions'
                                      ) <> '0'/*ORDER BY fb.asset_id*/
                UNION
                -- Disposal / Transferred / Retired
                (                                                       -- retired
                 SELECT   DISTINCT asset_id,
                                   cost,
                                   ytd_deprn,
                                   deprn_amount,
                                   deprn_reserve acc_deprn,
                                   cost - deprn_reserve net_bk_val,
                                   cip_cost,
                                   cip_cost_pk,
                                   description cat_desc,
                                   fat_desc sub_cat_desc,
                                   activity
                   FROM   (SELECT   DISTINCT
                                    fb.asset_id,
                                    fb.cost,
                                    0 cip_cost,
                                    0 cip_cost_pk,
                                    ds.ytd_deprn,
                                    ds.deprn_reserve,
                                    fc.description,
                                    fat.description fat_desc,
                                    ds.deprn_amount,
                                    'Disposal / Transferred / Retired' activity
                             FROM   fa_books fb,
                                    fa_additions_b fa,
                                    fa_methods fm,
                                    fa_financial_inquiry_cost_v fic,
                                    fa_categories_vl fc,
                                    fa_additions_tl fat,
                                    fa_deprn_summary ds,
                                    fa_mass_ext_retirements_v ret
                            WHERE       ds.asset_id = fa.asset_id
                                    AND fb.asset_id = fa.asset_id
                                    AND fb.asset_id = fic.asset_id
                                    AND fb.life_in_months = fm.life_in_months
                                    AND fb.book_type_code = ds.book_type_code
                                    AND fb.book_type_code = fic.book_type_code
                                    AND fa.last_update_date >
                                          TO_DATE (
                                                '01'
                                             || 'JAN'
                                             || TO_CHAR (SYSDATE, 'RRRR'),
                                             'DD-MON-RRRR'
                                    AND ds.deprn_run_date =
                                          (SELECT   DISTINCT MAX (deprn_run_date)
                                             FROM   fa_deprn_summary
                                            WHERE   asset_id = fb.asset_id)
                                    AND fic.transaction_header_id_in =
                                          (SELECT   DISTINCT
                                                    MAX (transaction_header_id_in)
                                             FROM   fa_financial_inquiry_cost_v
                                            WHERE   asset_id = fb.asset_id)
                                    AND fb.date_effective =
                                          (SELECT   DISTINCT MAX (date_effective)
                                             FROM   fa_books
                                            WHERE   asset_id = fb.asset_id)
                                    AND fa.attribute_category_code =
                                          fc.segment1 || '-' || fc.segment2
                                    AND fb.asset_id = ret.asset_id
                                    AND fa.asset_id = fat.asset_id
                                    AND fb.deprn_method_code = fm.method_code
                                    AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
                 UNION
                 --transfer
                 SELECT   DISTINCT asset_id,
                                   cost,
                                   ytd_deprn,
                                   deprn_amount,
                                   deprn_reserve acc_deprn,
                                   cost - deprn_reserve net_bk_val,
                                   cip_cost,
                                   cip_cost_pk,
                                   description cat_desc,
                                   fat_desc sub_cat_desc,
                                   activity
                   FROM   (SELECT   DISTINCT
                                    fb.asset_id,
                                    fb.cost,
                                    facc.cost cip_cost,
                                    0 cip_cost_pk,
                                    ds.ytd_deprn,
                                    ds.deprn_reserve,
                                    fc.description,
                                    fat.description fat_desc,
                                    ds.deprn_amount,
                                    'Disposal / Transferred / Retired' activity
                             FROM   fa_books fb,
                                    fa_additions_b fa,
                                    fa_methods fm,
                                    fa_financial_inquiry_cost_v fic,
                                    fa_categories_vl fc,
                                    fa_capitalize_cip_v facc,
                                    fa_additions_tl fat,
                                    fa_deprn_summary ds,
                                    fa_distribution_inquiry_v di
                            WHERE       ds.asset_id = fa.asset_id
                                    AND fb.asset_id = fa.asset_id
                                    AND fb.asset_id = fic.asset_id
                                    AND di.asset_id = fb.asset_id
                                    AND fb.life_in_months = fm.life_in_months
                                    AND fb.book_type_code = ds.book_type_code
                                    AND fb.book_type_code = fic.book_type_code
                                    AND fa.last_update_date >
                                          TO_DATE (
                                                '01'
                                             || 'JAN'
                                             || TO_CHAR (SYSDATE, 'RRRR'),
                                             'DD-MON-RRRR'
                                    AND ds.deprn_run_date =
                                          (SELECT   DISTINCT MAX (deprn_run_date)
                                             FROM   fa_deprn_summary
                                            WHERE   asset_id = fb.asset_id)
                                    AND fic.transaction_header_id_in =
                                          (SELECT   DISTINCT
                                                    MAX (transaction_header_id_in)
                                             FROM   fa_financial_inquiry_cost_v
                                            WHERE   asset_id = fb.asset_id)
                                    AND fb.date_effective =
                                          (SELECT   DISTINCT MAX (date_effective)
                                             FROM   fa_books
                                            WHERE   asset_id = fb.asset_id)
                                    AND di.transaction_header_id =
                                          (SELECT   DISTINCT
                                                    MAX (transaction_header_id)
                                             FROM   fa_distribution_inquiry_v
                                            WHERE   asset_id = fb.asset_id
                                                    AND transtype = 'TRANSFER')
                                    AND fa.attribute_category_code =
                                          fc.segment1 || '-' || fc.segment2
                                    AND fb.asset_id = facc.asset_id
                                    AND fa.asset_id = fat.asset_id
                                    AND facc.asset_type = 'CAPITALIZED'
                                    AND fb.deprn_method_code = fm.method_code
                                    AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
    GROUP BY   cat_desc, activity                                   
    ORDER BY   activityBrgds,
    Max

    Hi all,
    I have a matrix report which has dynamic as well as few fixed columns.
    It is a fixed asset Report in which the sum(cost) in cell should be grouped according to column and row-wise.
    The row consists of the activity such as additions, retirements etc and the dynamic column is the category and other fixed columns such as CIP cost, CWIP cost will be grouped only according to row.
    the actual layout should be like this
                     | category 1 | category 2 | category 3 ...... | CIP cost | CWIP cost
    Additions    | Sum(cost) | Sum(cost)  | Sum(cost)  .......| 1234      | 4500
    retirements | Sum(cost) | Sum(cost)  | Sum(cost)  .......| 1000      | 2500but due to fixed colums in the layout the report builder pushes the fixed colums to the next row with single query i get
                     | category 1 | category 2 | category 3 ...... |
    Additions    | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
                      CIP cost     | CWIP cost
                       1234        | 4500
    retirements | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
                      CIP cost     | CWIP cost
                       1000        | 2500if i try to add those columns alone in a seperate query and then build the report i get the layout like this
                     | category 1 | category 2 | category 3 ...... |
    Additions    | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
    retirements | Sum(cost) | Sum(cost)  | Sum(cost)  .......|
    CIP cost     | CWIP cost
    2234        | 7000This is my query, i have used union to get the row-wise column activity
    /* Formatted on 03-Sep-12 5:23:11 PM (QP5 v5.114.809.3010) */
      SELECT   DISTINCT /*ASSET_ID
                        SUM (cost),
                        SUM (cip_cost),
                        SUM (cip_cost_pk),
                        cat_desc--,sub_cat_desc
                        ,activity
        FROM   (-- cip cost
                SELECT   DISTINCT asset_id,
                                  cost,
                                  ytd_deprn,
                                  deprn_amount,
                                  deprn_reserve acc_deprn,
                                  cost - deprn_reserve net_bk_val,
                                  cip_cost,
                                  cip_cost_pk,
                                  description cat_desc,
                                  fat_desc sub_cat_desc,
                                  activity
                  FROM   (SELECT   DISTINCT
                                   fb.asset_id,
                                   fb.cost,
                                   facc.cost cip_cost,
                                   0 cip_cost_pk,
                                   ds.ytd_deprn,
                                   ds.deprn_reserve,
                                   fc.description,
                                   fat.description fat_desc,
                                   ds.deprn_amount,
                                   DECODE (
                                         facc.asset_type
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || di.transtype,
                                         'CIP'
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || 'TRANSFER',
                                      'CIP T/F',
                                      'CIP-0012-' || di.transtype,
                                      'Additions Project Khalifa assets',
                                      'CAPITALIZED-' || fc.segment1 || di.transtype,
                                      '0',
                                      'Additions'
                                      activity
                            FROM   fa_books fb,
                                   fa_additions_b fa,
                                   fa_methods fm,
                                   fa_financial_inquiry_cost_v fic,
                                   fa_categories_vl fc,
                                   fa_capitalize_cip_v facc,
                                   fa_additions_tl fat,
                                   fa_deprn_summary ds,
                                   fa_distribution_inquiry_v di
                           WHERE       ds.asset_id = fa.asset_id
                                   AND fb.asset_id = fa.asset_id
                                   AND fb.asset_id = fic.asset_id
                                   AND di.asset_id = fb.asset_id
                                   AND fb.life_in_months = fm.life_in_months
                                   AND fb.book_type_code = ds.book_type_code
                                   AND fb.book_type_code = fic.book_type_code
                                   AND fa.last_update_date >
                                         TO_DATE (
                                               '01'
                                            || 'JAN'
                                            || TO_CHAR (SYSDATE, 'RRRR'),
                                            'DD-MON-RRRR'
                                   AND ds.deprn_run_date =
                                         (SELECT   DISTINCT MAX (deprn_run_date)
                                            FROM   fa_deprn_summary
                                           WHERE   asset_id = fb.asset_id)
                                   AND fic.transaction_header_id_in =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id_in)
                                            FROM   fa_financial_inquiry_cost_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fb.date_effective =
                                         (SELECT   DISTINCT MAX (date_effective)
                                            FROM   fa_books
                                           WHERE   asset_id = fb.asset_id)
                                   AND di.transaction_header_id =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id)
                                            FROM   fa_distribution_inquiry_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fa.attribute_category_code =
                                         fc.segment1 || '-' || fc.segment2
                                   AND fc.segment1 <> '0012'
                                   AND fb.asset_id = facc.asset_id
                                   AND fa.asset_id = fat.asset_id
                                   --AND facc.asset_type <> 'CAPITALIZED'
                                   AND fb.deprn_method_code = fm.method_code
                                   AND ds.deprn_source_code <> 'BOOKS'
                                   AND DECODE (
                                         facc.asset_type || '-' || fc.segment1,
                                         'CIP-0012',
                                         'Additions Project Khalifa assets',
                                         'CAPITALIZED-' || fc.segment1,
                                         '0',
                                         'Additions'
                                      ) <> '0'/*ORDER BY fb.asset_id*/
                UNION
                --cip cost pk
                SELECT   DISTINCT asset_id,
                                  cost,
                                  ytd_deprn,
                                  deprn_amount,
                                  deprn_reserve acc_deprn,
                                  cost - deprn_reserve net_bk_val,
                                  cip_cost,
                                  cip_cost_pk,
                                  description cat_desc,
                                  fat_desc sub_cat_desc,
                                  activity
                  FROM   (SELECT   DISTINCT
                                   fb.asset_id,
                                   fb.cost,
                                   0 cip_cost,
                                   facc.cost cip_cost_pk,
                                   ds.ytd_deprn,
                                   ds.deprn_reserve,
                                   fc.description,
                                   fat.description fat_desc,
                                   ds.deprn_amount,
                                   DECODE (
                                         facc.asset_type
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || di.transtype,
                                         'CIP'
                                      || '-'
                                      || fc.segment1
                                      || '-'
                                      || 'TRANSFER',
                                      'CIP T/F',
                                      'CIP-0012-' || di.transtype,
                                      'Additions Project Khalifa assets',
                                      'CAPITALIZED-' || fc.segment1 || di.transtype,
                                      '0',
                                      'Additions'
                                      activity
                            FROM   fa_books fb,
                                   fa_additions_b fa,
                                   fa_methods fm,
                                   fa_financial_inquiry_cost_v fic,
                                   fa_categories_vl fc,
                                   fa_capitalize_cip_v facc,
                                   fa_additions_tl fat,
                                   fa_deprn_summary ds,
                                   fa_distribution_inquiry_v di
                           WHERE       ds.asset_id = fa.asset_id
                                   AND fb.asset_id = fa.asset_id
                                   AND fb.asset_id = fic.asset_id
                                   AND di.asset_id = fb.asset_id
                                   AND fb.life_in_months = fm.life_in_months
                                   AND fb.book_type_code = ds.book_type_code
                                   AND fb.book_type_code = fic.book_type_code
                                   AND fa.last_update_date >
                                         TO_DATE (
                                               '01'
                                            || 'JAN'
                                            || TO_CHAR (SYSDATE, 'RRRR'),
                                            'DD-MON-RRRR'
                                   AND ds.deprn_run_date =
                                         (SELECT   DISTINCT MAX (deprn_run_date)
                                            FROM   fa_deprn_summary
                                           WHERE   asset_id = fb.asset_id)
                                   AND fic.transaction_header_id_in =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id_in)
                                            FROM   fa_financial_inquiry_cost_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fb.date_effective =
                                         (SELECT   DISTINCT MAX (date_effective)
                                            FROM   fa_books
                                           WHERE   asset_id = fb.asset_id)
                                   AND di.transaction_header_id =
                                         (SELECT   DISTINCT
                                                   MAX (transaction_header_id)
                                            FROM   fa_distribution_inquiry_v
                                           WHERE   asset_id = fb.asset_id)
                                   AND fa.attribute_category_code =
                                         fc.segment1 || '-' || fc.segment2
                                   AND fc.segment1 = '0012'
                                   AND fb.asset_id = facc.asset_id
                                   AND fa.asset_id = fat.asset_id
                                   --AND facc.asset_type <> 'CAPITALIZED'
                                   AND fb.deprn_method_code = fm.method_code
                                   AND ds.deprn_source_code <> 'BOOKS'
                                   AND DECODE (
                                         facc.asset_type || '-' || fc.segment1,
                                         'CIP-0012',
                                         'Additions Project Khalifa assets',
                                         'CAPITALIZED-' || fc.segment1,
                                         '0',
                                         'Additions'
                                      ) <> '0'/*ORDER BY fb.asset_id*/
                UNION
                -- Disposal / Transferred / Retired
                (                                                       -- retired
                 SELECT   DISTINCT asset_id,
                                   cost,
                                   ytd_deprn,
                                   deprn_amount,
                                   deprn_reserve acc_deprn,
                                   cost - deprn_reserve net_bk_val,
                                   cip_cost,
                                   cip_cost_pk,
                                   description cat_desc,
                                   fat_desc sub_cat_desc,
                                   activity
                   FROM   (SELECT   DISTINCT
                                    fb.asset_id,
                                    fb.cost,
                                    0 cip_cost,
                                    0 cip_cost_pk,
                                    ds.ytd_deprn,
                                    ds.deprn_reserve,
                                    fc.description,
                                    fat.description fat_desc,
                                    ds.deprn_amount,
                                    'Disposal / Transferred / Retired' activity
                             FROM   fa_books fb,
                                    fa_additions_b fa,
                                    fa_methods fm,
                                    fa_financial_inquiry_cost_v fic,
                                    fa_categories_vl fc,
                                    fa_additions_tl fat,
                                    fa_deprn_summary ds,
                                    fa_mass_ext_retirements_v ret
                            WHERE       ds.asset_id = fa.asset_id
                                    AND fb.asset_id = fa.asset_id
                                    AND fb.asset_id = fic.asset_id
                                    AND fb.life_in_months = fm.life_in_months
                                    AND fb.book_type_code = ds.book_type_code
                                    AND fb.book_type_code = fic.book_type_code
                                    AND fa.last_update_date >
                                          TO_DATE (
                                                '01'
                                             || 'JAN'
                                             || TO_CHAR (SYSDATE, 'RRRR'),
                                             'DD-MON-RRRR'
                                    AND ds.deprn_run_date =
                                          (SELECT   DISTINCT MAX (deprn_run_date)
                                             FROM   fa_deprn_summary
                                            WHERE   asset_id = fb.asset_id)
                                    AND fic.transaction_header_id_in =
                                          (SELECT   DISTINCT
                                                    MAX (transaction_header_id_in)
                                             FROM   fa_financial_inquiry_cost_v
                                            WHERE   asset_id = fb.asset_id)
                                    AND fb.date_effective =
                                          (SELECT   DISTINCT MAX (date_effective)
                                             FROM   fa_books
                                            WHERE   asset_id = fb.asset_id)
                                    AND fa.attribute_category_code =
                                          fc.segment1 || '-' || fc.segment2
                                    AND fb.asset_id = ret.asset_id
                                    AND fa.asset_id = fat.asset_id
                                    AND fb.deprn_method_code = fm.method_code
                                    AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
                 UNION
                 --transfer
                 SELECT   DISTINCT asset_id,
                                   cost,
                                   ytd_deprn,
                                   deprn_amount,
                                   deprn_reserve acc_deprn,
                                   cost - deprn_reserve net_bk_val,
                                   cip_cost,
                                   cip_cost_pk,
                                   description cat_desc,
                                   fat_desc sub_cat_desc,
                                   activity
                   FROM   (SELECT   DISTINCT
                                    fb.asset_id,
                                    fb.cost,
                                    facc.cost cip_cost,
                                    0 cip_cost_pk,
                                    ds.ytd_deprn,
                                    ds.deprn_reserve,
                                    fc.description,
                                    fat.description fat_desc,
                                    ds.deprn_amount,
                                    'Disposal / Transferred / Retired' activity
                             FROM   fa_books fb,
                                    fa_additions_b fa,
                                    fa_methods fm,
                                    fa_financial_inquiry_cost_v fic,
                                    fa_categories_vl fc,
                                    fa_capitalize_cip_v facc,
                                    fa_additions_tl fat,
                                    fa_deprn_summary ds,
                                    fa_distribution_inquiry_v di
                            WHERE       ds.asset_id = fa.asset_id
                                    AND fb.asset_id = fa.asset_id
                                    AND fb.asset_id = fic.asset_id
                                    AND di.asset_id = fb.asset_id
                                    AND fb.life_in_months = fm.life_in_months
                                    AND fb.book_type_code = ds.book_type_code
                                    AND fb.book_type_code = fic.book_type_code
                                    AND fa.last_update_date >
                                          TO_DATE (
                                                '01'
                                             || 'JAN'
                                             || TO_CHAR (SYSDATE, 'RRRR'),
                                             'DD-MON-RRRR'
                                    AND ds.deprn_run_date =
                                          (SELECT   DISTINCT MAX (deprn_run_date)
                                             FROM   fa_deprn_summary
                                            WHERE   asset_id = fb.asset_id)
                                    AND fic.transaction_header_id_in =
                                          (SELECT   DISTINCT
                                                    MAX (transaction_header_id_in)
                                             FROM   fa_financial_inquiry_cost_v
                                            WHERE   asset_id = fb.asset_id)
                                    AND fb.date_effective =
                                          (SELECT   DISTINCT MAX (date_effective)
                                             FROM   fa_books
                                            WHERE   asset_id = fb.asset_id)
                                    AND di.transaction_header_id =
                                          (SELECT   DISTINCT
                                                    MAX (transaction_header_id)
                                             FROM   fa_distribution_inquiry_v
                                            WHERE   asset_id = fb.asset_id
                                                    AND transtype = 'TRANSFER')
                                    AND fa.attribute_category_code =
                                          fc.segment1 || '-' || fc.segment2
                                    AND fb.asset_id = facc.asset_id
                                    AND fa.asset_id = fat.asset_id
                                    AND facc.asset_type = 'CAPITALIZED'
                                    AND fb.deprn_method_code = fm.method_code
                                    AND ds.deprn_source_code <> 'BOOKS'/*ORDER BY fb.asset_id*/
    GROUP BY   cat_desc, activity                                   
    ORDER BY   activityBrgds,
    Max

  • Matrix Report with variable@incontext not working

    I had built a matrix report, using variable@incontext. I'm having a problem with my cell data. It seems that it is always using the value from the first record in the column instead of the actual value.
    ie in the example below, the data should make it come out like:
    Staff____01____02____03______
    Bob_____Bob_________Bob
    John____John__John___John
    Joe_____Joe___Joe____Joe
    but it's coming out like this (the data for John is wrong in column1 and 3 and the data for Joe is wrong in all columns) :
    Staff____01____02____03______
    Bob_____Bob_________Bob
    John____Bob___John___Bob
    Joe_____Bob___John___Bob
    Staff Column(Down):
    <?for-each-group:ROWSET2_ROW;./STAFF_NAME?><?variable@incontext:STAFF;STAFF_NAME?>
    <?STAFF_NAME?>
    Number Column (Across)
    <?for-each-group@cell://ROWSET2_ROW;PERIOD?>
    <?sort:current-group()/PERIOD;'ascending';data-type='text'?>
    <?if:count(current-group()[STAFF_NAME=$STAFF])?><?STAFF_NAME?><?end if?>
    <?end for-each-group?>
    <?end for-each-group?>
    It looks like the value for '$STAFF' and ?STAFF_NAME are not right when there was data in a previous column.
    Can anybody Help me?

    Hi,
    Can you please help me to solve the problem.
    Thanks in Advance
    Adina.

  • Matrix report with Date

    Hi All,
    How do I generate a report with colum is data and row is date like below, and then generate a chart that show the progress by each day. Thanks so much for your help.
    Date 03/17/2006 03/18/2006 03/19/2006 03/20/2006 .........
    My Data
    Data 1 2 20 3 28
    Data 2 3 35 0 0
    Data 3 6 88 9 7
    Data 4 8 123 100 88
    Best Regards,
    Andy Pham

    Hi Andy,
    In a matrix report, the usual problem with reporting by all the dates in a period is that they may be gaps in dates where there is no data for that day.
    Therefore, you will need to have a workaround by having a view with all the possible dates using something like the following SQL.
    eg
    CREATE VIEW MY_VIEW AS
    SELECT (TRUNC(sysdate) -30 + ROWNUM) DATES FROM user_objects WHERE rownum < 31;
    You can play around with this SQL to suit your requirements.
    In your query for the matrix report, include MY_VIEW to the query and outer join your date column to DATES. ie DATES = your_date_column(+)
    Use DATES as a MATRIX column field and it will give you 30 columns. The MATRX row field and MATRIX cell field will be your own data.
    One very important thing to note is your date column must be truncated to 0 hours and minutes otherwise you will not get matching records.
    Regards,
    John

  • Left shift with fill zero...

    hi group,
    We can apply ~ to int variable also.
    can u tell me what is the output of y?
    int x = -1;
    int y = ~x + 1;
    and as well as tell me what is the output of this stmts?
    int a = -1;
    a = a >>> 24;
    b'coz i know how to apply the bit representation of byte variable.
    but i don;t understand what is happening with letf shift fill zero variable in the second stmts
    can u ppl help me regarding this tricky stmts??
    thank u
    shalini.

    We can apply ~ to int variable also.
    can u tell me what is the output of y?
    int x = -1;
    int y = ~x + 1;
    y is 1.
    and as well as tell me what is the output of this
    stmts?
    int a = -1;
    a = a >>> 24;
    a is 255.
    b'coz i know how to apply the bit representation of
    byte variable.
    but i don;t understand what is happening with letf
    shift fill zero variable in the second stmts>
    The top bits are filled with zero (whereas with ">>" they would get the value of the sign bit) when shifting: 11001 >>> 1 is 01100 when 11001 >>> 1 would be 11100. Very simple.

  • Matrix report with literals as rows

    Hi all,
    I have been asked to write a report that lists userids as the columns and literals as the rows and the resulting counts for the cross product.
    The data is all coming from a statistics table of transactions by userid and the associated counts for a given day. The resulting report is to replace a manually created Excel spreadsheet. Having never worked with matrix reports I'm having difficulty getting the query to behave as I want.
    Here is a brief glimpse of what the user wants;
    USER1 USER2 USER3 ...
    Issued 1 2 4
    Rejected 0 4 2
    Salvaged 0 2 3
    Thanks for any help. It looks like a matrix report would be perfect for this user request, so any and all suggestions would be appreciated.
    Tom Vereecke

    Assuming 'Issued', 'Rejected' and 'Salvaged' are the fixed and these are the only values showed as rows. And also part of the table. You have to use three unions, something like that
    SELECT 'Issued' TranType, UserID, cnt
    FROM Table
    WHERE TransType = 1
    UNION
    SELECT 'Rejected', UserID, cnt
    FROM Table
    WHERE TransType = 2
    UNION
    SELECT 'Salvaged', UserID, cnt
    FROM Table
    WHERE TransType = 3
    Run Report wizard and select Matrix report.
    'TransType' will be Row Field.
    'UserID' will be Column Field.
    and 'Cnt' will be Cell Field.
    Hope this helps.

  • Calculate percentage between two rows in a matrix report with a single row group in SSRS 2008

    I need your help. I have a matrix report in ssrs 2008. The report contain one field value column and one value column. I need to calculate a percentage for two values. For example : row 1 : Discount 10 Row 2 : Sales 100 Result : 10/100. I have only one
    row group, I need to have a condition where Field = Discount % on Revenue then Discount/Total Turnover. Because of the  grouping for total, I am not being able to calculate the %, its just totalling the % discount. Kindly refer to the snapshot of the
    report.

    Hi Thanks a lot for your answer, but unfortunately it didn't work,the report is reading from a stored procedure which I have unpivot to convert all columns into rows, so that's why Discount % on Revenue, Discount and Total Turnover is found in one column.
    So the Field!Col.Value is the Discount % on Revenue, Discount and Total Turnover. I have tried to change the code to
    "=SUM(IIF(Fields!Col.Value = "Discount",Fields!value.Value),0))
    /IIF(SUM(IIF(Fields!Col.Value = "Turnover Total",Fields!value.Value),0)) = 0 ,
    Nothing,SUM(IIF(Fields!Col.Value = "Turnover Total",Fields!value.Value),0)))" but to no avail. Any other suggestion will be most welcome.
    Thanks.
    If everything you're getting from stored procedure then you need to calculate and bring the value from there itself.
    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

  • Matrix report with row field as "dates of months"

    Hi all,
    I have a matrix report that requires such a format:
    Some database column -->
    1 cell cell cell cell
    2 null null null null
    3
    4
    31 cell
    now i cannot get the dates of the month in order of 1 to 31'st as column, if i give my database column datefield the records which are on following date are displayed but for the dates which dont have records, the cell fields should be null..
    How would i do this.
    Regards,
    Sreekanth.

    Hi all,
    I have a matrix report that requires such a format:
    Some database column -->
    1 cell cell cell cell
    2 null null null null
    3
    4
    31 cell
    now i cannot get the dates of the month in order of 1 to 31'st as column, if i give my database column datefield the records which are on following date are displayed but for the dates which dont have records, the cell fields should be null..
    How would i do this.
    Regards,
    Sreekanth.

  • How to create a matrix report with xml

    Hi,
    I have a problem with a maxtrix report ,I got the output from the application but I don't know how to create it at the bi puplisher in order to get the righte template.
    So if any one know the answer or have a useful decomentation send it me .
    Eman.

    Have a look at this http://download.oracle.com/docs/cd/E12839_01/bi.1111/b32122/orbr_matrix.htm#g1017642
    -Ammad

  • Matrix report with Multiple queries

    I have created one cross product group containing 4 subgroups under a single query. Now I have another one query seperately to be joined with the matrix query. Also I have one formula column and summary column with this the cross product group. The logic is if formula condition is true the it should take the 2nd query value in the place holder column otherwise it should take the first query value. is it possible?
    If any one knows about this update me ASAP to [email protected]

    Isn't there a way for you to do this via a Package/Procedure versus having multiple queries?
    Per the BI Publisher guide,
    Following are recommended guidelines for building data models:
    Reduce the number of data sets or queries in your data model as much as possible. In general, the fewer data sets and queries you have, the faster your data model will run. While multiquery data models are often easier to understand, single-query data models tend to execute more quickly. It is important to understand that in parent-child queries, for every parent, the child query is executed.
    You should only use multiquery data models in the following scenarios:
    To perform functions that the query type, such as a SQL query, does not support directly.
    To support complex views (for example, distributed queries or GROUP BY queries).
    To simulate a view when you do not have or want to use a view.
    Thanks,
    Bipuser

  • Need help with Drill down Matrix Report

    Hi,
    I need to create a matrix report with a tree functionality with two line heading.
    Can some body tell me how can I generate this report?
    REGION1 REGION2 REGION3
    COL1 COL2 TOTAL COL1 COL2 TOTAL COL1 COL2 TOTAL
    ===========================================================
    CAT1+
    Sub_CAT1
    Sub_CAT2
    CAT2+
    Sub_SCAT3
    Sub_SCAT4
    Where CAT1 , CAT2 needs to be collapsible rows. SCAT1..SCAT4 are sub categories under main categories.
    REGION1.... REGION3 are top level headings. And COL1,COL2 are sub headings under top level headings.
    Thanks,
    Shrikant

    As I said when I believe you posted up a similar question under a different user name...., (yes, it's that easy to tell )
    Asking questions here about a version of Logic that was apparently, not legally purchased using  the Mac App Store.. is not wise.... no matter what your reasoning for not being able to afford it...
    Buy LPX, install it properly and then see if you have the same issues.....

Maybe you are looking for

  • Customer prices are not coming correctly!!!

    Hi Experts, Question: "Changes made in customer prices in ECC, how it gets replicated to ECO ISA application?". We have maintained customer specific condition records in ECC. Also, list prices have been maintained in product catalog. WIth replication

  • Folder size/calculation

    This is a two parter: The problem has to do with obtaining the size of a folder's contents when viewing the contents of a folder. It would be nice to look down at the bottom of the folder window and see a display such as: Desktop/Pod Movies - 1.52GB

  • DB03 & SPFILE SID .ORA

    Hi All, I've little confusion. I've configured total 51 parameters in my spfile<sid>.ora (some parameters are carried from the time of installation and some are set through brtools) & those all parameters are also reflecting in init<sid>.ora. I've ve

  • Color of highlighted pages in the Pages Pallet?

    A new option for menu items is to change their highlighted color. When you highlight "select" pages in the Pages Pallet... it is a light blue which is hard for me to see. How do I find the right menu in in the menu colorization options to change this

  • No fox tabs with V5? Is it possible to return to V4?

    I updated to V and now my fox tabs seems to incompatible, can I return to V4 until this is fixed?