Matrix Report Column Fields
Hi,
we are using oracle developer 9i, i have a matrix report, in which the matrix column are more than 100 so i have extended the page size to 20. i want the matrix column to be continued in next row. Pls help.
Thank you,
MNH
ex :
emp_doj :
01-jan-09
01-feb-09
01-mar-09
01-apr-09
01-may-09
01-jun-09
01-jul-09
01-aug-09
01-sep-09
01-oct-09
01-nov-09
01-dec-09
01-jan-10
01-feb-10....................
you need the output like this :
account no jan feb mar apr may jun jul aug sep oct nov sep dec jan feb mar
1 2 5 100 22 52 22 22 55 22 22 22 555 5 55 844
2 100 152 412 525 522 155
Just try to this way ,
column field --> for ex : emp_doj or otherwise u r matrix column date field
go to u r query :
select to_char(emp_doj,'Mon') as doj
*, emp_doj,........*from tablename
* two times u have select the matrix column field ,like above query emp_doj two time selected
You should give Alias Name --> to_char(emp_doj,'Mon') as doj
after that go to u r data model
Matrix column fields groups are should be this order
1) emp_doj( this should come first)
2) doj ( alias name u r given that field should come second )
after u compile run the report.
The report output will come like this
account no jan feb mar apr may jun jul aug sep oct nov sep dec jan feb mar
1 2 5 100 22 52 22 22 55 22 22 22 555 5 55 844
2 100 152 412 525 522 155
Similar Messages
-
Matrix report - row field text extends into cell field's display space
The horizontal elasticity of the row field in the matrix is set to VARIABLE. This row field's horizontal elasticity needs to be VARIABLE (not FIXED).
However, this causes problems because if the row field's text length is long, the matrix does not change accordingly, i.e. the cell field does not move to the right to make room for the row field. So the row field extends into the display space of the cell field, and the text of the row and cell field overlap, and so the text is almost impossible to read (as well as ugly).
I have tried to put a frame around the row and cell field so that they are together and move accordingly, but this hasn't helped. I have also tried anchors but they cause the fields to appear NULL when they are not.
Any help is appreciated.
-nelson
[email protected]I think you'll need to revert to a fixed sized field and increase the height of the field to cope with the number of rows that you could have.
You might be able to create a repeating frame above the matrix that tracks the matrix and pushes the whole matrix down as it expands, but I don't see how you could do this within the matrix structure itself. -
Month day display in matrix report
in matrix report date field convert into day and it is as row filed if any day of month data not found but it display all 30 days in matrix report.
try this query
select rownum as run_num,to_date('01-' || :A_MONTH || '-' || :A_YEAR,'dd/mm/yyyy')+ (rownum-1) CV from
(select 1 from dual group by cube (1,1,1,1,1)) -
: HIDING SUMMARY COLUMNS IN MATRIX REPORT , URGENT
Hi,
Can any one please tell me how to hide a column in oralce matrix report. Its a summary column for the matrix report which appears next to the cell values. For example
Manufacturer
Brand
SubBrand1 SubBrand2 Brand Total Manufacturer Total
Week $ Sales $ Sales Total $ Sales Total $ Sales
This is a case where,the cell value is the $ sales for the SubBrand for the week. And it gets total at each brand level and each Manufacturer level. The requrement is if there is only one SubBrand for a Brand then the Brand total should not appear on the report. Similarly if there is one Brand for a Manufacturer, then the total at Manufacturer level should not appear . The point is not only it should dissapear but the frame should srink to make it fell that there is no totaling going on at those two levels. If the fileds just remains blank then the report looks odd. So the gap should be srinked as well. How to do it . This is very urgent . Please help me out.
Thanks
Ferozuse a formst trigeer on the field that returns false when you don't want to display the field.
-
How to add a function field into the existing matrix report
Hi,
I have a matrix report , now i wanted to add one moe field into the matrix which is getting the value from a function , this function is a part of the ref cursor query(group) , i'm able to get the value from the function but it cannot display on the existing matrix report. i wanted to add this in the repeating frame which is printing down. how could i do this , looking for your help. thanks . bcjHere the scenario like,
Data from Table_1
NAME UNITS DAYS RATE
AAA 10 1 1.2
BBB 12 2 3.1
AAA 20 2 4.1
CCC 23 1 5.2
Here, In the matrix report the NAME and UNITS are row fields and 'DAYS' is column field , RATE would be the cell field, and
Data from Table_2 ,
NAME BASIC
AAA 2
AAA 2
BBB 2
CCC 3
In the report i have to display the 'BASIC' along with the NAME in row level ( repeating frame printing down),
To get the multiple 'Basic' for each 'Name' using a ref cursor .
and, using a function to do further calculation based on the basic value
begin
select basic into v_basic where name =:name;
return(caluculated_value);
end;
and return the calculated value to the report. But at that time cannot accommodate the value in the matrix report with other groups frequency.
looking for your valuable help. Thanks Bcj -
Hello, Expert,
Could you please help me with the following problem? Thanks in advance!
I have designed the matrix report (SSRS 2012) with database table structure looks like below.
Week
Version
Count
Week1
V1.1
4000
Week1
V1.2
4000
Week1
V1.3
4000
Week2
V1.1
3000
Week2
V1.2
3000
Week2
V1.3
3000
Week3
V1.1
2000
Week3
V1.2
2000
Week3
V1.3
2000
Week4
V1.1
1000
Week4
V1.2
1000
Week4
V1.3
1000
The matrix report displays like below. Column grows based on no of Week in the table.
Week1
Week2
Week3
Week4
V1.1
4000
3000
2000
1000
V1.2
4000
3000
2000
1000
V1.3
4000
3000
2000
1000
What I want to do now is: instead of the Count values, I need to calculate the percentage of each week over the
Count in Week1 so that each cell displays Count(Week2)/Count(Week1), Count(Week3)/Count(Week1), etc. What is the SSRS expression for that? I’m new to SSRS, Please help!Heidi,
Thank you so much for your reply and solution! Now I know how to get the first field in a group. But I can't apply your solution directly just yet because in order to explain my problem I simplified my data structure. My real data structure has a nested
group like this:
Week VersionMajor VersionMinor Count
Week1 V1 V1.1 2000
Week2 V1 V1.1 1500
Week3 V1 V1.1 800
Week1 V1 V1.2 1000
Week2 V1 V1.2 500
Week3 V1 V1.2 200
Week1 V1 V1.1 2000
Week2 V1 V1.1 1500
Week3 V1 V1.1 800
Week1 V1 V1.2 1000
Week2 V1 V1.2 500
Week3 V1 V1.2 200
Here is the query for the above data:
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
UNION ALL
SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
UNION ALL
SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
UNION ALL
SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
And my matrix table looks like this:
What I need to do is to calculate the percentage of each week over week1 for
1) V1 Total
2) V1.1
3) V1.2
I can't use your solution directly because I need to apply Sum function for each cell and the Sum function gives me error when I try to use it on the denominator
First(Fields!Count.Value,"VersionMinor"). If you could help me further to get to the final solution, I'd really appreciate it!!
Happy New Year! -
SSRS Matrix report to show or hide year column based on parameter value "Date" selected.
Hey experts!
I have a requirement an ssrs matrix report should display columns (year/s) based on parameter value (date/s).
My Dataset fileds are: Product, Year_name, Month_name, Date
Currently my report output looks like this-
Param Date: 2013-08-01 00:00:0.000
Product +Calender2011 +Calender2012 -Calender 2013........ +Calender2014
Total
Total Jan13 Feb 13 Mar13.. Dec13 Total Total
Abc 100
220
10 20 30....... 20 250 400
Xyz 110
200 50 80 40....... 30 450 600
My requirement: if I'm selecting Date parameter value as '2013-xx-xx' I should only able to see Year column 'Calender2013' and rest of the years should hide. Similarly If I'm selecting Date parameter value as '2014-xx-xx' I should only able to
see Year column 'Calender2014' .
Appreciate your kindly help.
AfanHi Afan,
According to your description, you want to only show the selected year on your report, right?
In this case, you need to get the year from the date parameter using the expression below
=Year(Parameters!Date.Value)
And then use the expression below to get the year from Year_Name field.
=Right(Fields!Year_Name.Value,4)
Then add a filter to the dataset to filter the data like below
Expression:=Year(Parameters!Date.Value)
Operator:=
Value:=Right(Fields!Year_Name.Value,4)
Reference
http://msdn.microsoft.com/en-IN/library/dd255287.aspx
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support -
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 Substract Adjacent Columns in SSRS Matrix Reports
Hello Experts!
Month 2005
2006
January 648343.8132
May 733248.3506
June 587549.2014
July 259933.2074
623172.5646
August 501182.4458 513690.3892
I have a report like this and i want to show the o/p like
Month 2005 2006 2005-2006
January 648343.8132 648343.8132
May 733248.3506 766248.3506
June 587549.2014 587549.2014
July 259933.2074
623172.5646 363239.3572
August 501182.4458 513690.3892 12507.9434
Tried using Previous Function but it is not working for Matrix Reports i.e. Overlapping Columns
Tried Custom Code like
Public Shared previous as Integer
Public Shared current as Integer
Public Shared Function GetCurrent(Item as Integer) as Integer
previous=current
current=Item
return current
End Function
Public Shared Function GetPrevious()
return previous
End Function
I've taken the Column Insert Column-->Insert Group-Right and in that i written the expression as
=Code.GetCurrent(fields!Score.Value) & "-Previous-" & iif(Code.GetPrevious()=0,"",Code.GetPrevious())
Still it is not working
Please help me regarding this
Thanks & Regards
VIJAYHello RSINGH,
Previous Function is not working Matrix Report. So i written the expression like
=SUM(Fields!Sales.Value)-Previous(SUM((Fields!Sales.Value)))
The result is is subtracting Row wise but i want to subtract Column Wise i.e. 2006 Jan-2005 Jan & 2007 Jan-2006 Jan & 2006 Feb-2005 Feb so on...
but with the above expression it is showing 2005 feb-2005 Jan and 2005 Mar-2005 Feb and son on -
Adding description column into wizard generated matrix report
Hi,
I currently have a matrix report that reports rows as job names and columns as media type. the intersection is the media code.
for example i have a job called abc and it has envelopes(e1,e2), base stationary (s1,s2) and inserts (i1,i2).
job envelope base stationary inserts
abc e1 s1 i1
e2 s2 i2
so far i have no problems. what i would like to do is add a description entry next to the inserts column. the description is only for the insert and only needs to be shown when an insert is present.
any ideas? i have tried adding in an additional field, however, i get some type of grouping error (my reports has just crashed so i can't get exact error)
thanks in advance for the help!Hi,
If I understood you right. Place the txt next to the insert field, then right click on the txt field and go to 'Conditional Formatting' then New. Put it in, if the value of Insert column is null, then click the 'Hide the Object' checkbox.
-Marilyn -
Hi all
I create matrix report( in version 9i)
I want sort columns of report
when i use order by it sort rows but i want sort columns
my query is like this:
SELECT
Code,
name,
DECODE(cons_code, '1', 'A',
'2', 'B',
'3','C',
'4', 'D',
'5', 'E') Activity,
SUM(amnt) amount
From Mytable
Where ....
group by
Code,
DECODE(cons_code, '1', 'A',
'2', 'B',
'3','C',
'4', 'D',
'5', 'E')
my group base on code
my columns base on Activity
and cells are Amount
my report result is:
........ B E D A C
name1 1 1 1 1 2
name2 3 4 8 6 1
I want this :
........ A B C D E
name1 1 1 1 1 2
name2 3 4 8 6 1
....Hello,
How about this?
SELECT Code, name,
DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D','5', 'E') Activity, SUM(amnt) amount
From Mytable
WHERE ....
GROUP BY Code, name, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E')
ORDER BY code, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E') -
Cannot edit a field that is "Standard Report Column" when new row added
Hi everyone,
I have created a master-detail form from the wizard and within the detail report region source I have used apex_item.xxx API
example;
select C1, C2,
CASE when C2 ='N' then
apex_item.select_list_from_query(3, C3,'select a1 d, a2 r from table1', 'ENABLED', 'NO',null,null, 'f03_#ROWNUM#')
else
apex_item.select_list_from_query(3, C3,'select a1 d, a2 r from table1', 'DISABLED', 'NO',null,null, 'f03_#ROWNUM#')
END C3
from table;
All columns C1,C2,C3 are defined as "Standard Report Columns".
The results allows the column C3 field to be enabled or disabled for input depending on a condition.
The problem is when you hit the default button "Add Row" to add a new row. The row is non-editable and is populated with null values.
What I want is to allow input when a new row is inserted into the multi-row detail form.
Can any one help?
Is there a way to change the Display As field for the new row columns to "text field" from "standard report column" dynamically?I think you will need to use the old way of adding rows instead of the new one. I remember having headaches trying to get it working.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/otn/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
------------------------------------------------------------------- -
SSRS 2005 - Dynamically control the width of columns in Matrix report or Hide any column
Hi All,
I just want to hide some column without having white space in Matrix report in SSRS 2005. Although I am aware of that perhaps this feature is not available on SSRS 2005. So, I just want to know if we can handle the width of column dynamically(using expressions)
in matrix report?
Please help. Thanks in Advance.
Regards
KumudHi Kumud,
Based on my test, SSRS is not support column dynamically width. It has property “CanGrow” of text box. If we configure the property to True, it will wraps to next line if needed. In SSRS 2008, we can hide some columns without white space. If possible, I
recommend you update your SSRS 2005 to SSRS 2008.
There is a similar issue, you can refer to it.
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/9e6043f1-c458-4540-be59-d37b02feab8a/dynamic-column-width-for-a-report?forum=sqlreportingservices
Alternatively, I recommend you that submit a wish to the Microsoft Connect at
https://connect.microsoft.com/SQLServer/Feedback. Your feedback is valuable for us to improve our products and increase the level of service provided.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
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,
MaxHi 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 -
How to calculate difference and percentage in matrix report dynamic columns in SSRS 2008
Hi Friends,
I need to calculate Difference and Percentage In matrix report SSRS 2008
1) Row grouping based On Product
2) Column Grouping Week and Fiscal Year Current week and Previous Year same Weeks
3)Data Invnetory(Value fileld)
Example:
If value1 and Value2 Available we need to calculate Percentage and Difference.Otherwise Not required NA I need to Show.
For example If Particular week,Current year data is available,Previous year week data is not available No
need to cal Diff and Percentage we need to show Empty.
Below Code is working for If two values is available.
If any one of the fiscal year week data is not there it's taking some garbage values.
I tries with If condition in GetPCT() and GetDiff() It's not working.
Can some one please help me on this.
I am using the custom code
Public Shared Value1 as String
Public Shared Value2 as String
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as String,partner as String,Week as String) as String
If partner =previous and Week =previousweek Then
Value2=Value
Else
previous=partner
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
Public Shared Function GetPct()
return (Value2-Value1)/Value1
End Function
How to handle this.
Thank You, Manasa.VHi veerapaneni,
According to your description, if one of the fiscal year week doesn’t have data, the custom code returns false results.
For your requirement, if NULL value exists in the database, we should replace it as zero then perform calculate. So within the code, we should judge whether the value is NULL. To achieve your goal, please refer to the steps below:
1. Create a table like below.
create table dif4
([Product Group] varchar(50),
[Week] varchar(50),
[Fiscalyearweek] varchar(50),
value int
insert into dif4 values
('Desktops','W01','FY14W01',0),
('Desktops','W01','FY15W01',45),
('Desktops','W02','FY14W02',null),
('Desktops','W02','FY15W02',30),
('Desktops','W03','FY14W03',12),
('Desktops','W03','FY15W03',50),
('Notebooks','W01','FY14W01',35),
('Notebooks','W01','FY15W01',56),
('Notebooks','W02','FY14W02',45),
('Notebooks','W02','FY15W02',87),
('Notebooks','W03','FY14W03',75),
('Notebooks','W03','FY15W03',105),
('Tablets','W01','FY14W01',34),
('Tablets','W01','FY15W01',46),
('Tablets','W02','FY14W02',49),
('Tablets','W02','FY15W02',96),
('Tablets','W03','FY14W03',42),
('Tablets','W03','FY15W03',113)
2. Add the custom code in the Report Properties.
Public Shared Value1 as Integer
Public Shared Value2 as Integer
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
If Value=Nothing Then
Value=0
End If
If product =previous and Week =previousweek Then
Value2=Value
Else
previous=product
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetPct()
If Value1=0 Then
return 0
Else
return (Value2-Value1)/Value1
End If
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
3. Design the matrix like below.
4. Then get the expected results.<o:p></o:p>
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support
Maybe you are looking for
-
Hi! I need advice as to which card I should buy. Currently using Realtek on-board sound. I already read the thread about the differences of these 2 cards but I am still having second thoughts. As of now I am in favor of buying the Audigy 4 due to its
-
Tax codes - can you set up default value for rows and freight? HELP!
Hello - I have two issues with tax codes: 1. When adding a sales order if any of the rows do not have a value for "Tax Code" I will get an error "Row without tax was found". - How can I get all rows on my sales orders, documents, etc to default to
-
System (ntoskrnl.exe) high cpu usage in Windows 8.1
Sir/Mam, I'm having this issue since last week, when i checked it is the "system" (ntoskrnl.exe) file which is using upto 18-24% of my CPU and causing all other applications to stutter for a second (incluuding Media player, mouse pointer, everything)
-
I have been editing MTS files (AVCHD) from a Panasonic GH2 (Some hacked some stock firmware) for over 2 years with little to no issues. I am using the CS5.5 Master Collection, Premiere Pro in this case, on a 3 year old Sager laptop (64-bit, i-7 720qm
-
Full-text search containstable AND logical operator performance problem
I have the following clause in my SQL statement: CONTAINSTABLE(subject_ifts, SearchText, '"smith*" AND "n*"', LANGUAGE 1033) It takes approximately 60 seconds to return 840 rows from a total of 4 millions rows in the searched table. If the search con