Formula Column in Matrix Report (Running Balance)
Hi all. I hope somebody can help me.
I am working on a matrix report using multi-query data models. The report has 2 groups in the horizontal axis and 3 groups in the vertical axis. The intersection is not just a single row but may consist of multiple rows.
My problem is this. I want to create a column in the intersection which is obtained by using a column value from the lowest group in the vertical axis and a summary column obtained from the rows of the intersection.
Here's what my report looks like:
2002 (accross)
2002(down) january february (accross)
January (down) payments balance payments balance
loan #1 10,000 500 9,000 200 8,800
500
loan #2 5,000 100 4,900 200 4,700
February
loan #3 3,500 0 3,500 50 3,450
loan #4 4,200 0 4,200 0 4,200
As you can see, the loans are grouped by month and year. And the payments are grouped for the month and year too.
The data model is :
For Query 1 (Vertical Axis),
1st group - Loan Yr
2nd group - Loan Mo
3rd group - Loan # and amount
For Query 2 (Horizontal Axis)
1st group - Payment Yr
2nd group - Payment Mo
Intersection Group - Payment Amount
My problem actually is how to compute for the running balance of the loan for each month in the horizontal axis. Ive already created a cross product summary to get the running total of the payments made for the month. I tried creating a formula column to for the running balance by subtracting it from the loan amount but i get the error "incompatible frequency"
I hope i have described my problem well and thanks for the help
The problem is that you're trying to reference dimension columns(loan Amount) in the calculation of matrix cell values. You can only reference other matrix cell values or cross product columns (summary, formula, placeholders) when calculating matrix cell values. Try moving the (loan Amount) column down to the matrix cell - something like:
For Query 1 (Vertical Axis),
1st group - G_LoanYear(LoanYr)
2nd group - G_LoanMonth(LoanMo)
3rd group - G_LoanNumber(Loan#)
For Query 2 (Horizontal Axis)
1st group - G_PaymentYear(PaymentYr)
2nd group - G_PaymentMonth(PaymentMo)
Intersecion /Detail Group - G_Details(PaymentAmount, LoanAmount)
Then create the following Matrix summary columns:
A running summary - CS_Payments:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- Source: PaymentAmount
- Function: Sum
- Reset At: G_LoanNumber
The total amount per loan - CS_TotalPayment:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber
- Source: LoanAmount
- Function: First
- Reset At: G_LoanNumber
The value of the loan after each payment - CF_Countdown:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- PL/SQL Formula:
function CF_CountdownFormula return Number is
begin
return(:CS_TotalPayment - :CS_Payments);
end;
You should then be able to display "CF_Payments" and "CF_Countdown" in the matrix cell to show how much has been paid and how much is still owed.
You can still have another "loan amount" as a dimension column - you just don't need to use it when calculating the values in the cell.
Similar Messages
-
Formula Columnn in Matrix Report (Running Balance)
Hi all. I hope somebody can help me.
I am working on a matrix report using multi-query data models. The report has 2 groups in the horizontal axis and 3 groups in the vertical axis. The intersection is not just a single row but may consist of multiple rows.
My problem is this. I want to create a column in the intersection which is obtained by using a column value from the lowest group in the vertical axis and a summary column obtained from the rows of the intersection.
Here's what my report looks like:
2002 (accross) 2003
januar february (accross
payments balance paymenst balance
2002 (down)
Januar (down)
Loan#1 10,000 500 9000 200 8800
500
Loan#2 5000 100 4900 200 4700
February
Loan#3 3500 0 3500 50 3450
Loan#4 4200 0 4200 0 4200
As you can see, the loans are grouped by month and year. And the payments are grouped for the month and year too.
The data model is :
For Query 1 (Vertical Axis),
1st group - Loan Yr
2nd group - Loan Mo
3rd group - Loan # and amount
For Query 2 (Horizontal Axis)
1st group - Payment Yr
2nd group - Payment Mo
Intersecion /Detail Group - Payment Amount
My problem actually is how to compute for the running balance of the loan for each month in the horizontal axis. Ive already created a cross product summary to get the running total of the payments made for the month. I tried creating a formula column to for the running balance by subtracting it from the loan amount but i get the error "incompatible frequency"
I hope i have described my problem well and thanks for the helpThe problem is that you're trying to reference dimension columns(loan Amount) in the calculation of matrix cell values. You can only reference other matrix cell values or cross product columns (summary, formula, placeholders) when calculating matrix cell values. Try moving the (loan Amount) column down to the matrix cell - something like:
For Query 1 (Vertical Axis),
1st group - G_LoanYear(LoanYr)
2nd group - G_LoanMonth(LoanMo)
3rd group - G_LoanNumber(Loan#)
For Query 2 (Horizontal Axis)
1st group - G_PaymentYear(PaymentYr)
2nd group - G_PaymentMonth(PaymentMo)
Intersecion /Detail Group - G_Details(PaymentAmount, LoanAmount)
Then create the following Matrix summary columns:
A running summary - CS_Payments:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- Source: PaymentAmount
- Function: Sum
- Reset At: G_LoanNumber
The total amount per loan - CS_TotalPayment:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber
- Source: LoanAmount
- Function: First
- Reset At: G_LoanNumber
The value of the loan after each payment - CF_Countdown:
- Product Order: G_LoanYear G_LoanMonth G_LoanNumber G_PaymentYear G_PaymentMonth
- PL/SQL Formula:
function CF_CountdownFormula return Number is
begin
return(:CS_TotalPayment - :CS_Payments);
end;
You should then be able to display "CF_Payments" and "CF_Countdown" in the matrix cell to show how much has been paid and how much is still owed.
You can still have another "loan amount" as a dimension column - you just don't need to use it when calculating the values in the cell. -
Howto use formula columns in matrix reports
Hello
How can i use a formula column in matrix report whose function would be
Formula_Column_Result=A-B where A=Cell A
B =Cell B
Regards
FahadHii guys
I solved my problem on my own.
i wrote
SELECT * FROM EMP WHERE EMP.DEPTNO=P_DEPT_NO
and it worked.
Thanks guys..i luv this forum
Regards
Fahad Hameed -
How to add a formula column in a report
Hi
I have made a report based on a query.
There are 3 columns in the query and all the 3 are displayed.
Now I want to add a new column (fomula column) to the report.
I want to write a query inside the formula column. To execute the query col1, col2 and col3 values are required in the formula column.
Could you please tell me how to add a formula column in the report and how to pass database column value to inside the formula column
regardsHere is how you would create a formula column:
Open data model of the report.
Formula column button is on the left side of the tool palette.
Click on that button.
Now click in the query group where you want to place the formula column.
You would see a new field something like CF_1. That is the formula column.
Double click on the field CF_1. It will open property inspector.
You would see, Datatype of the formula column is Number. Change this as per your requirement.
Double click on PL/SQL Formula property. It would open up a editor. Here you can write the code.
And now to access the data model column here, you can use : and column name. i.e. :col1 or :col2, etc
And remember you have to return the value back to the formula column. Like this: RETURN(some value).
You can also take a help from here:
http://download.oracle.com/docs/html/B13895_01/orbr_howto.htm#sthref1309
Hope this helps. -
About formula column in oracle report
I want the output value of the formula column in my report between two brackts ....ex: (28.99) ...can anyone give me the idea
Do u mean that brackets have to be appeared only when the value is +ve/-ve. then you need to use (9999) in the format mask of the property pallette of the text column. if you want to use the brackets for all the data, then the solution has been provided by many of our frnds.
-
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') -
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 -
: 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.
-
Using PL/SQL in a formula column in Oracle Reports Builder.
Hi,
I need to SUM two record from the result of an SQL interrogation.
Here's what it looks like
function CF_1Formula return Number is
nTot1 NUMBER :=0;
nTot2 NUMBER :=0;
begin
select sum(:TOT1) into nTot1 from table(Q1) ;
select sum(:TOT2) into nTot2 from table(Q1) ;
return (nTot1 + nTot2);
end;I'm kind of new to formula column programming any link of interest would be appreciated.
The from table(Q1) part Q1 represents my SQL interrogation name and the group below it is G_MAIN.Hi Hong Kong King Kong,
From looking at that function name (and the group name): Is this an Oracle Reports generated function?
If so, there's also a dedicated Reports forum: Reports
By the way, I like your synonym for 'query'.
I'm sure I'll confuse some of my collegues tomorrow when I will mention 'database interrogation' instead of 'query'. ;)
edit
Doh...I should not underestimate the information that is posted in thread subjects.
Edited by: hoek on May 5, 2010 9:24 PM -
How to Hide a column in a report @run time
Hello Can you help me please
I need to hide some columns in a report when you run it , I dont want it to be displayed.
Here is the scenerio.
I have a column called (QTY) and the other (Price). Now I have a new one where I take
(Qty*Price) and the result is in a column called(qtyprice)now I only want to display of the qtyp*price at the end of the report.
can you help please
Thank you
alphaTheir are so many ways to do this..
1.simplest thing is just delete that field from your layout so it will not apperar.
2.go to layout and right click on that field and go to property and just click hide so that field will be hide while running the report.
3. when you create a layout at that time just deselect that fields so it will not appeare in report while it running. -
Display null rows / columns in matrix report
Hi,
Is it possible to display any character ('0' for example) in a matrix report where the entire row or column show no value at all ?
My matrix shows Row1 and Row2 with values but no Row3 at all like this:
Column1 Column2 Column3
Row1 value1 value2 value3
Row2 value4 value5 value6
But I would like it to show my rows 3 with '0's :
Column1 Column2 Column3
Row1 value1 value2 value3
Row2 value4 value5 value6
Row3 0 0 0
Thank you,
DeniseMake your query return 0 with nvl(column, 0) and an outer join, plus some stuff to avoid a double outer join.
E.g. a sales per product per city:
City1 City2 City3
Prod1 10 100 12
Prod2 25 110 200
Prod3 0 0 0Could be made like this:
create table city (c_city varchar2(10));
create table prod (p_prod varchar2(10));
create table prod_sales (ps_city varchar2(10)
, ps_prod varchar2(10)
, ps_sales number);
<.....insert some values, except voor Prod3 .....>
SQL> select p_prod, c_city, nvl(ps_sales,0)
2 from (select c_city, p_prod from city, prod)
3 , prod_sales
4 where ps_city(+) = c_city
5 and ps_prod(+) = p_prod
6 order by 1,2 ;
P_PROD C_CITY NVL(PS_SALES,0)
Prod1 City1 10
Prod1 City2 100
Prod1 City3 12
Prod2 City1 25
Prod2 City2 110
Prod2 City3 200
Prod3 City1 0
Prod3 City2 0
Prod3 City3 0 -
WAD: add new formula / structure element to report run by user
Hi,
I know that there is a possibility to add a formula or "structure element" to a WAD report that is being run by a user (user opens WAD report and can add a formula). We are using WAD 7. Unfortunately I don't know where this function is hidden in WAD (I am new to WAD....).
Thanks!Hi Steve,
Make sure you have the following web item and property enabled in your WAD template.
~ Context Menu Item > Local Formula
Once this is enabled, you can run the WAD report, right click and select Calculations and Translations > Formula > Create New formula
This will populate teh formula builder.
Hope this helps.
Regards
Snehith. -
Formula Column in Report template
I have a report template to use in all the report. I want to have a formula column on it to take a control value(location/Organization) where the report is being printing. Is it possible to have a formula column in a report template? if it possible how can I do it? otherwise how can i achieve this task?
Thank in advance
Muza.What is the application release?
Can you find any details about the error in the OPP log file?
Please search MOS website for "Cannot view XML input using XSL style sheet" and go through the docs.
Thanks,
Hussein -
Using the 'LOG' Function in a Formula Column
If I write the following SQL statement at the SQL prompt, it works :
SELECT LOG(sal,10) FROM emp ; But, if I write a similar statement in the formula column of a report, then it does not work :
SELECT LOG(sal,10)
INTO x_variable
FROM emp
WHERE empno = :empno ;
return (TRUE) ;
It would be great if someone can help.Try This..
In the formula columns pl/sql place the following:
function cf_1Formula return number is
num number;
begin
num := log(sal, 10);
return ( num );
end;
-- cf_1 is the formula col name
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by [email protected]:
If I write the following SQL statement at the SQL prompt, it works :
SELECT LOG(sal,10) FROM emp ; But, if I write a similar statement in the formula column of a report, then it does not work :
SELECT LOG(sal,10)
INTO x_variable
FROM emp
WHERE empno = :empno ;
return (TRUE) ;
It would be great if someone can help. <HR></BLOCKQUOTE>
null -
Dynamic SQL in Formula Column in OracleReports6i
Following code is in formula column of my report. passing dynamic sql str1(actullay, this string comes from after parameter trigger form) into SQL and executing thru DBMS_SQL.PARSE function. it's failed with 'Fatal PL/SQL error occured' ...
Coupld any one help me on this...
function CF_1FORMULA0006 return Number is
Credits1 NUMBER(10,2);
str1 VARCHAR2(50) := 'AND b.PROGRAMID = 2 ';
c1 INTEGER := dbms_sql.open_cursor;
c2 INTEGER;
begin
begin
dbms_sql.parse(c1,
'SELECT NVL(SUM(a.AMOUNT),0) INTO Credits1' | |
'FROM SPONSOR_TRAN_DATA a, SPONSOR b ' | |
' WHERE ' | |
' a.TRANTYPE = 41 ' | |
' AND a.SPONSORID = b.SPONSORID ' | |
str1 | |
'AND a.amount > 0 ' | |
'AND a.timestamp >= :reportdate ' | |
'AND a.timestamp < :reportdate + 1' ,2);
c2 := dbms_sql.execute(c1);
exception
when no_data_found then
Credits1 := 0;
end;
return Credits1;
end;
Thanks in advance......It looks like forms are not supporting text functions like FR yet, I gave it a try <<MemberName("<Formname>","<POV DIM Name>)>> in the formula header area and it didn't like it. It is just displaying what ever I typed in there.
Maybe you are looking for
-
How to change the column header/channel name in an LVM file?
Hi all, I made a VI (see attached JPG) that reads 2 voltages, but after calculations and other processes, ends up writing 6 columns of data to an LVM file (7 if you count the time). I have read in other posts that you can change the name of each sign
-
CS4 Crashes on start-up w/ Vista 64
This is the information I get when I open the Microsoft window and I don't understand any of it. Does anyone know what I should do to solve this dilema? Fred Problem signature: Problem Event Name: APPCRASH Application Name:
-
PGC...data rate too high
Hallo, message nunew33, "Mpeg not valid error message" #4, 31 Jan 2006 3:29 pm describes a certain error message. The user had problems with an imported MPEG movie. Now I receive the same message, but the MPEG that is causing the problem is created b
-
Shift planning-automatic proposal
Dear All, I need to have 4 employees on sunday (which is an off day).. but my requirement is to have 4 employees from 8.00AM to 17.00Pm (day shift) (daily work schedule has been assigned to shift group +abbrivation) I have created a requirement for
-
Export multiple frames of a composition with layers intact
I'm working with lower quality video and after many headaches with codecs I finally started using image sequences so I could do editing in photoshop then bring it into After Effects. Now I want to go the other way. Export an image sequence with lay