Adding ssrs chart for each group under group footer
Hi,
I have requirement of report design, user has ability to select single or multiple product name in parameter and it should display column headers for each group and chart for each group (product name).
Report Design
ProductName: A
Category JAN
FEB MAR
Sales 10
12 15
Budget 20
20 20
Chart Here
ProductName: B
Category JAN
FEB MAR
Sales 10
12 15
Budget 20
20 20
Chart Here
I want to repeat this for all products.
Please anyone can provide steps to how to achieve this design?
Hi Srikanth,
According to your description, you want to design a tablix to display header and chart for each group in its group header and footer. Right?
In Reporting Service, when we add header and footer for a group, the header row and footer row are still within this group. Anything we put in these two rows will be grouped. For your requirement, we created a sample report in our local environment. Here
are steps and screenshots for your reference:
1. Create a matrix. Columns are grouped by month. Rows are grouped by ProductName (with group header and footer).
2. Put the text/field of the first row into the group (ProductName) header. Delete the header row of matrix (the first row), select Delete rows only.
3. Insert a chart into the group footer. It looks like below:
4. Add a parameter for filtering data. Save and preview it looks like below:
Reference:
Understanding Groups (Report Builder and SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou
Similar Messages
-
Hi
I am currently adding a chart for each group on group footer in a table.
but i want that charts to be on the right side of the group data.
regards
Pratap M:)Hi PratapM,
If I understand correctly, you have already added a chart in group footer, and you want to display the chart on the right side of the cell. If I have misunderstood, please don't hesitate to let me know.
Based on my research, if we directly add a chart into a cell, the chart will fill all of the space in the cell. So in order to achieve your requirement, we can insert this chart into a rectangle, then add the rectangle to the group footer. If we want to
display the chart on the right side, we can directly drag the chat to the right of the rectangle.
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Custom sorting within "for-each-group:current-group"
Hi, I need some help in doing a custom sort within a "for-each-group:current-group". My formatting is in a table format but I'm not sure how to post a table here so I'm just arranging the column details out as it would look in a table. I have a column on the left for the YEAR and a second column on the right for the DESCR. Under the DESCR column I've inserted a nested table with four columns: SUBJECT, CATALOG_NBR, DESCR250 and GRADE.
COLUMN 1:
<?for-each-group:row_table;./ YEAR?><?sort: YEAR;'ascending';data-type='text'?><?YEAR?>
COLUMN 2:
<?for-each-group:current-group();./DESCR?><?DESCR?>
NESTED TABLE (with 4 columns):
+<?for-each:current-group()?><?SUBJECT?><?CATALOG_NBR?><?DESCR250?><?GRADE?><?end for-each?>+
<?end for-each-group?> <?end for-each-group?>
I'm able to sort by YEAR in the "for-each-group" on the left column. But I also want to do a custom sort on DESCR in the right column.
I've seen this blog on custom sorting by Vetriselvan: http://winrichman.blogspot.com/2009/09/custom-dynamic-sort-in-bi-publisher.html and I tried inserting this sort below after <?for-each-group:current-group();./DESCR?> but I get an error message.
<?sort:(number(DESCR='Status')*1)+(number(DESCR='First Semester')*2)+(number(DESCR='Second Semester')*3);'ascending';data-type='number'?>
I've also seen this thread: Re: Sort within group and tried inserting <?for-each:DESCR?> before the sort (as below) - this time I can preview the results, but it is not sorting as required.
<?for-each:DESCR?><?sort:(number(DESCR='Status')*1)+(number(DESCR='First Semester')*2)+(number(DESCR='Second Semester')*3);'ascending';data-type='number'?>
Can anyone help me custom sort the DESCR column? I'm using Template Builder for Word version 5.6 build 45. Thanks in advance for any help!Hi Vetsrini,
I tried adding <?sort: ./DESCR;'ascending';data-type='text'?> after <?for-each-group:current-group();./DESCR?> but I'm getting an error message.
The DESCR values are below and I'm trying to sort them in the following order.
STATUS
SUMMER SEMESTER
FIRST SEMESTER
AUTUMN SEMESTER
WINTER SEMESTER
SECOND SEMESTER
SPRING SEMESTER
Because I need them in the above order, I can't use ascending or descending, and instead need to use a custom sort order. Do you know how I can go about creating a custom sort order?
Thanks! -
Asset transfer report - for-each-group
- <FAS430>
- <LIST_G_SETUP>
- <G_SETUP>
<COMPANY_NAME>ABCD</COMPANY_NAME>
<LOCATION_FLEX_STRUCTURE>101</LOCATION_FLEX_STRUCTURE>
- <LIST_G_ASSET_TRANS>
- <G_ASSET_TRANS>
<ASSET_NUMBER>1321780</ASSET_NUMBER>
<ASSET_DESCRIPTION>CABLES & CONNECTORS</ASSET_DESCRIPTION>
<TAG_NUMBER>K-PM-B-HCB-3899</TAG_NUMBER>
<TRANSNUM>3512926</TRANSNUM>
- <LIST_G_TRANSFERS>
- <G_TRANSFERS>
<TO_FROM>0</TO_FROM>
<GL_ACCOUNT>81216</GL_ACCOUNT>
<COMP_CODE>118</COMP_CODE>
<COST_CENTER>000</COST_CENTER>
<LOCATION>KANNUR CHALODE NONE CHALODE NONE</LOCATION>
<START_DATE>21-JUL-08</START_DATE>
<UNITS>-200</UNITS>
<ASSIGNED_TO />
<CCID>6705</CCID>
- <LIST_G_SUB>
- <G_SUB>
<DEPRN_RESERVE>0</DEPRN_RESERVE>
<COST>-89983.26</COST>
<YTD_DEP>702</YTD_DEP>
</G_SUB>
- <G_SUB>
<DEPRN_RESERVE>-18.96</DEPRN_RESERVE>
<COST>0</COST>
<YTD_DEP>702</YTD_DEP>
</G_SUB>
</LIST_G_SUB>
<D_GL_ACCOUNT>81216</D_GL_ACCOUNT>
<D_COMP_CODE>118</D_COMP_CODE>
<D_COST_CENTER>000</D_COST_CENTER>
<D_LOCATION>KANNUR.CHALODE.NONE.CHALODE.NONE</D_LOCATION>
<D_AS_COST><89,983.26></D_AS_COST>
<D_AS_DEPRN_RSV><18.96></D_AS_DEPRN_RSV>
<AS_COST>-89983.26</AS_COST>
<AS_RESERVE>-18.96</AS_RESERVE>
</G_TRANSFERS>
- <G_TRANSFERS>
<TO_FROM>1</TO_FROM>
<GL_ACCOUNT>81216</GL_ACCOUNT>
<COMP_CODE>118</COMP_CODE>
<COST_CENTER>000</COST_CENTER>
<LOCATION>KANNUR CHALODE NONE CHALODE NONE</LOCATION>
<START_DATE>21-JUL-08</START_DATE>
<UNITS>199</UNITS>
<ASSIGNED_TO />
<CCID>6705</CCID>
- <LIST_G_SUB>
- <G_SUB>
<DEPRN_RESERVE>18.87</DEPRN_RESERVE>
<COST>0</COST>
<YTD_DEP>702</YTD_DEP>
</G_SUB>
- <G_SUB>
<DEPRN_RESERVE>0</DEPRN_RESERVE>
<COST>89533.34</COST>
<YTD_DEP>702</YTD_DEP>
</G_SUB>
</LIST_G_SUB>
<D_GL_ACCOUNT>81216</D_GL_ACCOUNT>
<D_COMP_CODE>118</D_COMP_CODE>
<D_COST_CENTER>000</D_COST_CENTER>
<D_LOCATION>KANNUR.CHALODE.NONE.CHALODE.NONE</D_LOCATION>
<D_AS_COST>89,533.34</D_AS_COST>
<D_AS_DEPRN_RSV>18.87</D_AS_DEPRN_RSV>
<AS_COST>89533.34</AS_COST>
<AS_RESERVE>18.87</AS_RESERVE>
</G_TRANSFERS>
- <G_TRANSFERS>
<TO_FROM>1</TO_FROM>
<GL_ACCOUNT>81216</GL_ACCOUNT>
<COMP_CODE>118</COMP_CODE>
<COST_CENTER>000</COST_CENTER>
<LOCATION>KANNUR CHALODE MW BB NONE CHALODE MW BB NONE</LOCATION>
<START_DATE>21-JUL-08</START_DATE>
<UNITS>1</UNITS>
<ASSIGNED_TO />
<CCID>6705</CCID>
- <LIST_G_SUB>
- <G_SUB>
<DEPRN_RESERVE>.09</DEPRN_RESERVE>
<COST>0</COST>
<YTD_DEP>702</YTD_DEP>
</G_SUB>
- <G_SUB>
<DEPRN_RESERVE>0</DEPRN_RESERVE>
<COST>449.92</COST>
<YTD_DEP>702</YTD_DEP>
</G_SUB>
</LIST_G_SUB>
<D_GL_ACCOUNT>81216</D_GL_ACCOUNT>
<D_COMP_CODE>118</D_COMP_CODE>
<D_COST_CENTER>000</D_COST_CENTER>
<D_LOCATION>KANNUR.CHALODE MW BB.NONE.CHALODE MW BB.NONE</D_LOCATION>
<D_AS_COST>449.92</D_AS_COST>
<D_AS_DEPRN_RSV>0.09</D_AS_DEPRN_RSV>
<AS_COST>449.92</AS_COST>
<AS_RESERVE>.09</AS_RESERVE>
</G_TRANSFERS>
</LIST_G_TRANSFERS>
<DPIS>30-JUN-08</DPIS>
<ASSET_CATEGORY>BT</ASSET_CATEGORY>
</G_ASSET_TRANS>
We are trying to use XML Publisher to create an Asset transfer report. The element TO_FROM=0 denotes the From part of the asset transfer, the TO_FROM=1 denotes the To part of the asset transfer.. in this case we have a asset 200 units transfered 199 and 1 to two locations..in out rtf we are getting only the first line i.e.199..we have begin the group by <?for-each-group@section:G_ASSET_TRANS;ASSET_NUMBER?><?variable@incontext:G2;current-group()?>. In the units column we are giving <?$G2/LIST_G_TRANSFERS/G_TRANSFERS[./TO_FROM=1]/UNITS?>
Edited by: user648077 on Nov 3, 2008 10:26 PMHi Srini,
Thanks for the help..we got it resolved at out end.. we added another group <?for-each-group:$G2/LIST_G_TRANSFERS/G_TRANSFERS[./TO_FROM=1];LIST_G_SUB?><?variable@incontext:G3;current-group()?> and then used it in the units column...<?$G3/UNITS?>
Thanks
Ramanathan -
Single row table with for-each group loop to set variable.
Hi: There is probably a simple answer for this but I have not found it ...
I have a single row table to loop through a group to set a variable holding a running amount. I am not displaying the amount within the table however when I preview the report I see that the table is expanding (adding rows) for each loop.
The single row table has 3 columns.
1st column
<?for-each:AC_GROUP?>
2nd column
<?xdoxslt:set_variable($_XDOCTX,'xAmtVar',xdoxslt:get_variable($_XDOCTX,'xAmtVar')+CURRENT_AMOUNT)?>
3rd column
<?end for-each?>
Should I be using <?for each-group?> or something else. My requirement is to set the value of the variable with the running total but because the loop is adding rows for each value it loops through (even though not displayed), it is moving other areas of the layout off the page.
Hope this makes sense. Thanks in advance.you can do it many ways.
No need to loop
You can create a variable and put the sum amount directly in that.
<?doxslt:get_variable($_XDOCTX,'xAmtVar',sum(/AC_GROUP/CURRENT_AMOUNT))?>or
loop thru and add like you do.
<?for-each@inlines:AC_GROUP?><?xdoxslt:set_variable($_XDOCTX,'xAmtVar',xdoxslt:get_variable($_XDOCTX,'xAmtVar')+CURRENT_AMOUNT)?><?end for-each?>do give any space or enter character in word between them, just put this in a single form-field will do
But as i said, i would certainly go with first option. -
Using If condition in For EACH Group
Hi all,
I want to use if condition in for-each-group. Basically my requirement is that i want to use dynamic grouping. There will be two groups and the upper group and lower group will be selected on the basis of a report parameter.
I hope i made it clear enough. So please help me in this. Any ideas will be highly appreciable.
Thanks and regards
NaveedYou can add a If condition filed after the for-each field
for EG : <?if:ADDRESS_TYPE = 'Employee Address'?>
and then add anothet field which has <?end if?>
Hope this helps.
Thanks, -
Getting the first row for each group
Hi Everyone,
I have a query which returns a number of rows, all of which are valid. What I need to do is to get the first row for each group and work with those records.
For example ...
client flight startairport destairport stops
A fl123 LGW BKK 2
A fl124 LHR BKK 5
B fl432 LGW XYZ 7
B fl432 MAN ABC 8
.... etc.
I would need to return one row for Client A and one row for Client B (etc.) but find that I can't use the MIN function because it would return the MIN value for each column (i.e. mix up the rows). I also can use the rownum=1 because this would only return one row rather than one row per group (i.e. per client).
I have been investigating and most postings seem to say that it needs a second query to look up the first row for each grouping. This is a solution which would not really be practical because my query is already quite complex and incorporating duplicate subqueries would just make the whole thing much to cumbersome.
So what I really new is a "MIN by group" or a "TOP by group" or a "ROWNUM=1 by group" function.
Can anyone help me with this? I'm sure that there must be a command to handle this.
Regards and any thanks,
Alan Searle
Cologne, GermanySomething like this:
select *
from (
select table1.*
row_number() over (partition by col1, col2 order by col3, col4) rn
from table1
where rn = 1In the "partition by" clause you place what you normally would "group by".
In the "order by" clause you define which will have row_number = 1.
Edit:
PS. The [url http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions004.htm#i81407]docs have more examples on using analytical functions ;-)
Edited by: Kim Berg Hansen on Sep 16, 2011 10:46 AM -
Top N for each grouping?
Is there a way to show in OBIEE the Top N results for each group?
I want to show the top 10 amounts for each region in my table. If using a Top N filter, it returns the Top N overall results. I tried creating a pivot table and using 'Region' as the section separator, but got the same results. It's only returning 10 amounts total, and I want to see 10 amounts for each region.
KevinYep,
Use the by statement:
TOPN("F1 Revenue"."1-01 Revenue (Sum All)", 10 by "D2 Market"."M01 Market")
regards
John
http://obiee101.blogspot.com/ -
?for-each-group? dosen't work with page break - rtf template???
Hello all,
When I give a page break inside the for-each-group the group doesn't iterate any code after the page break. I can't give <?split-by-pagebreak?> in this case because I want that loop to be iterated for every department, and should show the report in one column(ms word column), and the department description in two columns.....as this has to happen for every department I can't write separate code........everything should go into one file......
Final file should look like:
<for every department>
<department_report-a table>--one column(ms word column)
<department_description-a huge text>--two columns(ms word columns)
<next department>
how can I achieve this - please help, its urgent.
Thanks for your time.
DKbipuser thanks for your response
i will have table data also so i cannot keep in the same line.
its strange for the last 2-3 days below syntax gave me space at the beginning of each group now it is working i didnt do any change
<?for-each:G_1?>
ABCDEFDG
<?split-by-page-break:?><?end for-each?> -
How to compare the value node of a for-each-group with other for-each-group
Hello!
I have a report in Oracle BI Publisher (10.1.3.2) with several data set. My XML schema is something like
<DATA>
<PARAMETERS>
<MY_PARAMETERS>
<A_ID>12345</A_ID>
<DESCRIPTION>ABC</DESCRIPTION>
<VALUE>111111</VALUE>
</MY_PARAMETERS>
<MY_PARAMETERS>
<A_ID>12345</A_ID>
<DESCRIPTION>DEF</DESCRIPTION>
<VALUE>222222</VALUE>
</MY_PARAMETERS>
<MY_PARAMETERS>
<A_ID>67890</A_ID>
<DESCRIPTION>ABC</DESCRIPTION>
<VALUE>333333</VALUE>
</MY_PARAMETERS>
</PARAMETERS>
<NAMES>
<MY_NAMES>
<A_ID>12345</A_ID>
<NAME>ASDF</NAME>
</MY_NAMES>
<MY_NAMES>
<A_ID>67890</A_ID>
<NAME>EFGH</NAME>
</MY_NAMES>
</NAMES>
<VALUES>
<MY_VALUES>
<A_ID>12345<A_ID>
<VALUE>10987</VALUE>
<DESCRIPTION>ASDFG</DESCRIPTION>
</MY_VALUES>
<MY_VALUES>
<A_ID>12345<A_ID>
<VALUE>26385</VALUE>
<DESCRIPTION>EFGHI</DESCRIPTION>
</MY_VALUES>
<MY_VALUES>
<A_ID>67890<A_ID>
<VALUE>24355</VALUE>
<DESCRIPTION>ASDFG</DESCRIPTION>
</MY_VALUES>
</VALUES>
</DATA>
I'm trying to build a rtf template in Word using this XML schema. The "A_ID" nodes in each group in my data have the same value. I want for each "A_ID" take the respective values in /DATA/VALUES/MY_VALUES.
<?for-each-group:MY_PARAMETERS;./A_ID?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='ABC'?>
<?VALUE?>
<?end when?><?end choose?>
<?end for-each?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='DEF'?>
<?VALUE?>
<?end when?><?end choose?>
<?end for-each?>
<?/DATA/NAMES/MY_NAMES/VALUE?>
<?for-each-group:/DATA/VALUES/MY_VALUES;./A_ID?>
<?for-each:current-group()?>
<?choose:?><?when: DESCRIPTION='ASDFG'?>
<?VALUE?> <---------------- I obtain for this node the '24355' and '10987' values
<?end when?><?end choose?>
I want to know how to obtain only '24355' value, this is, the value for A_ID (/DATA/VALUES/MY_VALUES) = A_ID (/DATA/PARAMETERS/MY_PARAMETERS).
Can someone help me?CREATE OR REPLACE TRIGGER "TEST_TRG"
BEFORE UPDATE OF "STATUS"
ON "TABLE1"
FOR EACH ROW
BEGIN
IF (:NEW.status = 'HOLD')
THEN
INSERT INTO table2
(status
VALUES (:NEW.status
END IF;
END;You should learn how to write PL/SQL code.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
------------------------------------------------------------------- -
Last() not returning correct value within for-each-group
I've found inconsistent results between JDeveloper and SOA Suite using the xslt 2.0 for-each-group construct.
<xsl:for-each-group select="Po/PoLine" group-by="itemId">
<xsl:if test="position()=1">
<GroupCount>
<xsl:value-of select="last()"/>
</GroupCount>
</xsl:if>
</xsl:for-each-group>
What I expect is the function last() to give me the number of groups which is the unique number of itemIds.
In JDeveloper 10.1.3.4, testing this construct gives me what I expect.
At run-time (deployed to 10.1.3.3 SOA Suite), the value returned is the total number of records, not the number of groups.
For example, given the following XML
<Po>
<PoLine>
<itemId><strong>001</strong></itemId>
<description>Hammer</description>
<quantity>10</quantity>
</PoLine>
<PoLine>
<itemId><strong>001</strong></itemId>
<description>Hammer</description>
<quantity>10</quantity>
</PoLine>
<PoLine>
<itemId><strong>002</strong></itemId>
<description>Nail</description>
<quantity>10</quantity>
</PoLine>
</Po>
Grouping by <strong>itemId</strong>, last() should return 2 as there are two groups (001 and 002). JDeveloper does this.
When deployed to SOA Suite, last() returns 3.
Any ideas?Hi,
if JDeveloper is doing the right thing then this issue should be reported to the SOA Suite forum or BPEL BPEL , what do you think ?
Frank -
There are tables(and columns) like:
'Clients'(clientID)
'Houses' (houseID)
'Visits' (clientID, houseID, visit_date)
'Contracts'(contractID, houseID, clientID, rentDate_from, rentDate_end)
I have problem with writing MS SQL query of this kind:
how many visits to houses did each client, before renting one of them?
Its easy to count total number of Visits for each client, listing all visits + group by clientID and selecting count(*) for each group.
Lets say this is select_1, and select_2 is listing all Contracts for all clients.
Select_1 is not answer, because count must be performed only on groups, which:
-have at least 1 row "like" row in select_2 (it means that at least one of visited houses was rented, because it can happen that client visited few houses, but rented other, not visited house). my idea for this is comparing select_1 and select_2 with:
"where s1.clientID=s2.clientID and s1.houseID=s2.houseID"
-each group must have all rows(visits) with date of same day or earlier than contract date
maybe: "datediff(day, s1.visit_date, s2.rentDate_from) >= 0"In future, please provide proper DML, DDL and example data, like I have for you below.
DECLARE @clients TABLE (clientID INT, name VARCHAR(20))
INSERT INTO @clients (clientID, name)
VALUES (1, 'Jonathan'),(2, 'Christopher'),(3, 'James'),(4, 'Jean-Luc'),(5, 'William')
DECLARE @houses TABLE (houseID INT, address VARCHAR(20))
INSERT INTO @houses (houseID, address)
VALUES (1, 'NX01'),(2, 'NCC 1701'),(3, 'NCC 1071A'),(4, 'NCC 1701D'),(5, 'NCC 1701E')
DECLARE @visits TABLE (clientID INT, houseID INT, visitDateTime DATETIME)
INSERT INTO @visits (clientID, houseID, visitDateTime)
VALUES (1,1,'2001-01-01 12:13:14'),
(2,2,'2001-01-02 12:13:14'),
(3,2,'2001-01-01 12:13:14'),(3,3,'2001-01-01 12:13:14'),
(4,4,'2001-01-01 12:13:14'),(4,5,'2001-01-01 12:13:14'),
(5,4,'2001-01-01 12:13:14'),(5,5,'2001-01-01 12:13:14')
DECLARE @contracts TABLE (contractID INT IDENTITY, houseID INT, clientID INT, rentStartDate date, rentEndDate date)
INSERT INTO @contracts (houseID, clientID, rentStartDate, rentEndDate)
VALUES (1,1,'2001-01-02',NULL),(2,2,'2001-01-02',NULL),(3,3,'2001-01-02',NULL),(4,4,'2001-01-02',NULL),(5,5,'2001-01-02',NULL)
SELECT contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address, COUNT(v.clientID) AS visits
FROM @contracts c
LEFT OUTER JOIN @clients cl
ON c.clientID = cl.clientID
LEFT OUTER JOIN @houses h
ON c.houseID = h.houseID
LEFT OUTER JOIN @visits v
ON c.clientID = v.clientID
AND c.rentStartDate >= v.visitDateTime
GROUP BY contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address -
Reset Page Number for each Group
I am currently creating a RTF template using XMLP 5.0
My demanding boss gets back in town in five days, and he expects
this report to be ready for production. :)
But I haven't been able to figure out one last spec.
The page number needs to be reset for each group.
So for example, the total report is about 83 pages.
In my RDF file (from Oracle Apps), I am grouping by a DEPT field.
In my RTF template, I am page breaking on each DEPT.
The page numbering should also be reset to 1 on each DEPT break.
The reason for this, is that the report will be printed, then separated by DEPT.
This way, each DEPT in the plant can receive their own individual report.
Is there anyway to do this using XMLP 5.0?
We would be willing to upgrade our XMLP,
if this functionality is available in a later version.
Thanks in advance.
Mark KHi Mark
Yep, you can do this, you can even do it in 5.0 :o)
For some reason it did not make the user doc in 5.0 ... an Easter egg if you like.
So I'd recommend getting the 5.5 or later docs and using that for reference. Just search for "About Oracle XML Publisher Release 5.5" on metalink once you have that doc search it for "Oracle XML Publisher User's Guide" its a link to the PDF document.
Then check pg 86/290 - Advanced Report Layouts > Batch Reports for details. This approach will work for 5.5. If you would like a sample then if you have installed the template builder there is an Advanced > Repeating Headers folder inwhich you will find an example.
Regards, Tim -
Query to find the latest two transactions for each Group
Hi All,
Consider the following sets of records in a table test.
Group---Tran_Dt---SlNo
c1 10/10/2003 1
c1 10/10/2003 2
c1 10/10/2003 3
c1 11/10/2003 1
c2 10/10/2003 1
c2 10/10/2003 2
c2 11/10/2003 1
c2 11/10/2003 2
c2 11/10/2003 3
c3 10/10/2003 1
c3 10/10/2003 2
c3 10/10/2003 3
I want to list out the latest two transactions for each group irrespective of the slno and trans_dt as below:
group tran_dt SlNo
c1 11/10/2003 1
c1 10/10/2003 3
c2 11/10/2003 3
c2 11/10/2003 2
c3 10/10/2003 3
c3 10/10/2003 2
Any help on this would be appreciated.
Thanks
Walter Nicholas THi Walter,
Please try following query.
select Group,tran_dt,sino from
select Group,tran_dt,sino,(DENSE_RANK()OVER (PARTITION BY Group ORDER BY tran_dt desc,sino desc)) rank from test
) where rank between 1 and 2
Thanks,
Samir -
How to handle goup sub total for each group in oracle query ?
hi,
i want to handle one complex thing in oracle query.
i have a grouping in my oracle query.
i want to do sub total for each group in query and after that i want to subtract one group sub total from previous group subtotal ?
so how can i handle this in oracle query ?
any help is greatly appreciated.
thanks.Hello
Interesting requirement.
I wonder why are you not using these calculation during the display time. If it is acceptable then you can try using the custom formula with the running total combination in crystral report to achieve to get the required results.
Best regards
Ali Hadi
Maybe you are looking for
-
Battery , time , signal strength bar is not getting displayed in home screen , these will be displayed only when i click on any app. Can u let me know the setting change ?
-
Adobe Files .pdf is not printing in Citrix Session
We open a .pdf files and tried to print in my citrix session but nothing happens. Not showing the file is printing and no printed pdf in my printer. Adobe Reader - version 9.4.1
-
How do you down scale a photo to fit my wallpeper? You can zoom in but cant zoom out to make photo fit to screen size...
-
Reg: COA Output for Delivery Document
Dear Gurus, While creation of COA Output we need to enter the Delivery document. I need to find out a Material in a Delivery Document for which the Inspection results are available Is there any link between Delivery document and the Inspection result
-
Current Service Pack/Fix Pack of Xcelsius 2008?
I have Xcelsius Version 5.1.2 (build 12.1.2.439) installed on a server. When I click "Manage Add-Ons" I get a C++ run time error. On another server I have 5.0.0.99 (build 12.1.0.247). That version seems to allow me to manage add-ons. What service p