Getting rate for my report
Hi All,
I would like some help with this query. This is my sample code:
create table myReport(
report_id integer,
product_class_id integer,
place_id integer,
fy integer);
insert into myReport(report_id, product_class_id, place_id, fy)
values (1, 1, 1, 2012);
insert into myReport(report_id, product_class_id, place_id, fy)
values (2, 1, 2, 2011);
insert into myReport(report_id, product_class_id, place_id, fy)
values (3, 1, 3, 2011);
insert into myReport(report_id, product_class_id, place_id, fy)
values (4, 2, 2, 2012);
insert into myReport(report_id, product_class_id, place_id, fy)
values (5, 2, 5, 2011);
insert into myReport(report_id, product_class_id, place_id, fy)
values (6, 3, 1, 2012);
insert into myReport(report_id, product_class_id, place_id, fy)
values (7, 4, 1, 2012);
create table myRates(
rate_id integer,
product_class_id integer,
place_id integer)
insert into myRates(rate_id, product_class_id, place_id)
values(1, 1, 1);
insert into myRates(rate_id, product_class_id, place_id)
values(2, 1, 2);
insert into myRates(rate_id, product_class_id, place_id)
values(3, 1, null);
insert into myRates(rate_id, product_class_id, place_id)
values(4, 2, 1);
insert into myRates(rate_id, product_class_id, place_id)
values(5, 2, 2);
insert into myRates(rate_id, product_class_id, place_id)
values(6, 2, null);
create table myRatesByYear(
rate_id integer,
fy integer,
rate integer)
insert into myRatesByYear(rate_id,fy,rate)
values(1, 2011, 5);
insert into myRatesByYear(rate_id,fy,rate)
values(1, 2012, 15);
insert into myRatesByYear(rate_id,fy,rate)
values(2, 2011, 6);
insert into myRatesByYear(rate_id,fy,rate)
values(2, 2012, 12);
insert into myRatesByYear(rate_id,fy,rate)
values(3, 2011, 7);
insert into myRatesByYear(rate_id,fy,rate)
values(3, 2012, 14);
insert into myRatesByYear(rate_id,fy,rate)
values(4, 2011, 8);
insert into myRatesByYear(rate_id,fy,rate)
values(4, 2012, 16);
insert into myRatesByYear(rate_id,fy,rate)
values(5, 2011, 9);
insert into myRatesByYear(rate_id,fy,rate)
values(5, 2012, 18);
insert into myRatesByYear(rate_id,fy,rate)
values(6, 2011, 2);
insert into myRatesByYear(rate_id,fy,rate)
values(6, 2012, 4);As you see I have a rate table by rate_id, product_class_id, place_id and year
select r.rate_id, r.product_class_id, r.place_id, y.fy, y.rate
from myRates r
join myRatesByYear y on y.rate_id = r.rate_id;
rate_id product_class_id place_id fy rate
1 1 1 2011 5
1 1 1 2012 15
2 1 2 2011 6
2 1 2 2012 12
3 1 NULL 2011 7
3 1 NULL 2012 14
4 2 1 2011 8
4 2 1 2012 16
5 2 2 2011 9
5 2 2 2012 18
6 2 NULL 2011 2
6 2 NULL 2012 4I would like to get the rate for my report table base. The search for the rate first will be base on product_class_id, year and place_id, second if the report row match the product_class_id and year but not place_id it should get the default rate (in my rate table the place_id is null).
Last if the report row doesn't match any key the result should be zero.
This is my result query, how can I do this query?
report_id product_class_id place_id fy rate
1 1 1 2012 15
2 1 2 2011 6
3 1 3 2011 7
4 2 2 2012 18
5 2 5 2011 2
6 3 1 2012 0
7 4 1 2012 0I try to do a function by don't know how to handle the default place_id (null)
I hope this is clear... Thanks!
Best,
Hi,
Here's one way to do that:
WITH got_r_num AS
SELECT re.*
, y.rate
, ROW_NUMBER () OVER ( PARTITION BY re.report_id
ORDER BY r.place_id NULLS LAST
) AS r_num
FROM myreport re
LEFT OUTER JOIN myrates r ON r.product_class_id = re.product_class_id
AND NVL ( r.place_id
, re.place_id
) = re.place_id
LEFT OUTER JOIN myratesbyyear y ON y.rate_id = r.rate_id
AND y.fy = re.fy
SELECT report_id
, product_class_id
, place_id
, fy
, NVL ( rate
, 0
) AS rate
FROM got_r_num
WHERE r_num = 1
ORDER BY report_id
;Output:
` PRODUCT
REPORT _CLASS PLACE
_ID _ID _ID FY RATE
1 1 1 2012 15
2 1 2 2011 6
3 1 3 2011 7
4 2 2 2012 18
5 2 5 2011 2
6 3 1 2012 0
7 4 1 2012 0This outer-joins the myreport table to the result set you posted, keeping only the rows where myrates.place_id is either NULL or the same as myreport.place_id. From there, it's a matter of picking the best match, when there is a choice, where rows with non-NULL myrates.place_id are better than rows with NULL myrates.place_id. Picking the best row, however "best" is defined, is often a job for the analytic ROW_NUMBER function.
Similar Messages
-
How to get data for Planning reports in 'CRM Interactive BI Reports' ?
Hi ,
Can you please let me know how can we get the data for the Planning Reports?
Do we have any specific data in the BI system related to Planninin Reports?
Planning Reports are :
1. Plan/Actual Comparison
2. Plan/Actual Monitor
3. Plan/Actual Analysis
4. Plan/Actual Compar. (YTD/YTG)
5. Sales Volume Forecast
6. Plan/Actual Net Revenue/Cust.
7. Plan/Actual Net Revenue/Prod.
Thanks
RaviWe should have a separate BI system to get the data for all these reports.
Regards
Ravi -
Variables are not getting changed for rs_pres_plan report
Hi Guys,
I'm trying to use the RS_prec_plan report for broadcasting but my variables which I'm selecting in as a varaint in workbook is not getting replaced.
Its taking from the saved view of the workbook.I read note 1154928 which explains the same issue but no luck any help would be appreciated.
Thanks
RCan anybody pls provide their suggestions?
Thanks in Advance! -
Which way to get image for webi report?
Hi,
I have to add image to webi report. So any way is there for adding image for webi intelligence.check this thread:
Adding an image (logo) to webi report -
I downloaded ipad apps instead of ipod apps that i paid for . How do I get refunded for these
To report an issue with a purchase (request a refund), follow these steps:
• Open iTunes. If you are already signed in, skip to step 4.
• Choose Store > Sign in.
• Enter your account name and password, then click the Sign In button.
• Choose Store > View My Account
• Click the Purchase History button
• Click the Report a Problem button at the bottom of your purchase history
• Click the arrow next to the purchase with which you want to report an issue
• Click the Report a Problem link next to the item with which you wish to report an issue
• Click the Problem menu
• Choose the option that best describes the issue. If none of the options match your issue, choose "My concern isn't listed here."
• Write comments about the issue (optional).
• Click the Submit button -
Reg: License for Crystal report redistributable
Hi....
I am Working on Asp.Net Crystal reports, I had deployed the application on client side,is it necessary to get license for crystal report redistributable at client side(not at developer side)?. If so how to get license and what is the cost for getting license any idea....You will need to talk to sales about specifics as it all depends on what version of the product you are using.
Typically if you are using a stand alone version either the customer would need to have a licensed copy of CR or you will need to have purchased the [Developer Advantage|http://www.sap.com/solutions/sapbusinessobjects/sme/reporting-dashboarding/reporting/developeradvantage/index.epx]
Jason -
I have a situation, where i need to write expression Period to date(PTD). i want to know how to get the period date. i want you to help in writing Period date or else is there any function to get period date for a given date(the date is given
from the parameter dynamically) in MDX for SSRS report
ramHi ram,
Per my understanding that you want to get the period date based on the month selected and the given date, right?
Could you please provide details information below to help us better understanding your requirements, thus we will be more effective to provide an solution:
What is the format of the period date you want to get, is this date in the DB and you want to filter it based on the month and the given Date?
Did the month and given date are two parameters in the report? if possible, could you please provide some sample data in the DB and also the snapshot of the report structure
I assume you want to get the period date(mm/dd/yyy) between the select month(e.g:Feb) and the given date (10/1/2014) and you should get the date between(02/01/2014-10/1/2014).
If so,and you also have two parameter "Month","EndDate"(EndDate is the given date), please reference to details information below:
You can create an new parameter "BeginDate" (Date/Time) which is the begin date of the period, you can use the expression to get the value based on the value of the month and the year value from the given date,finally hide this parameter:
Specify the available value:
Label:=Parameters!Month.Value &"/01/"& DatePart("yyyy",Parameters!EndDate.Value)
Value:=CDate(=Parameters!Month.Value &"/01/"& DatePart("yyyy",Parameters!EndDate.Value))
Specify the default Value:
Value:=CDate(=Parameters!Month.Value &"/01/"& DatePart("yyyy",Parameters!EndDate.Value))
Add filter to the dataset as below:
Preview you will get all the date in the given Period:
If you still have any problem, please feel free to ask.
Regards
Vicky Liu -
NOT Getting Values for LOCATION...on MultiProvider REPORT
HI All,
I have a MultiProvider on 4 cubes.All these 4 cubes having object LOCATION. I can see data in all cubes for LOCATION. I am running a report on this MultiProvider.
Problem:
I am not getting Values for LOCATION. Why?
What I did:
I checked all location objects of all 4 cubes @ MultiProvider level .
I didn't use any Infoprovider in Qry designer sections.
Please suggest. What is the reason how to solve..
THanks & Regards.
Sri.
Edited by: siri26 k on Dec 5, 2008 10:41 AM
Edited by: siri26 k on Dec 5, 2008 10:41 AMhello,
in the identification tab of the MP,make sure you have checked all four checkboxes across the 4 infoproviders.
then in Listcube T-Code, select your MP,display the records based on selection inputs and see if location is populated.
If the data is not coming in listcube, then it will not come in the Query too.
Reg,
Dhanya -
I refuse to pay for a one year automatic subscription for Cosumer report that was charged to my account today without me noticing. How can I cancel that and get reimbursed now?
PatrickFirst turn off auto-renewing subscriptions:
iTunes Store: Purchasing and managing auto-renewing subscriptions
Getting a refund won't be as simple. For that you will have to contact iTunes Store Support. -
How to get total,maximum,mimumum no. of cases for this report
Description: Reason For Contact For Customer - This report will provide the total number of cases created for a particular Reason For Contact for a particular Customer with a valid Business Code. This report will also provide the Maximum, Minimum and Average number of cases created for a particular Reason For Contact for that particular type of Customer. This report will take From Date, To Date, Agent Group and Business Code as inputs and generates the report on the screen. All the input criteria will be mandatory.
See the attachment for the Report.
NOTE :1) FOR TOTAL,WE HAVE COUNT NUMBER OF CASES CREATED for a particular Reason For Contact for a particular Customer with a valid Business Code
2) FOR Maximum, Minimum and Average CONSIDER number of cases created for a particular Reason For Contact for that particular type of Customer.
For this report,I am using 5 tables. In the table ScaseParty i have C_Bus_Code,C_cust_type coulumns are there.
I am taking Input Criteria For Business code(ie c_bus_code).suppose business code is 'F0106',I have to get how many cases(means records) are there for a particular Reason For Contact for that Business Code.I AM GETTING THE TOTAL BUT
for getting maximum,minimum,average , i have to check the C_cust_type For that Business code ,after that I have to take all the business codes for that C_Cust_Type and with in the business codes ,i have to take the maximum number of cases which business code have for that particular Reason for contact For that particular customer type.
Eg: Reason for contact Businesscode customer type
Delivery Timing 0306 1
Delivery Timing 0306 1
Delivery Timing 0310 1
Delivery Timing 0310 1
Delivery Timing 0310 1
Delivery Timing 0310 1
In this way i want the result
Maximum =4 since, for reason for contact(delivery timing) for that customer type(customer type =1),the maximum no. of cases are 4 bcz, business code = 0310 comes 4 times.
Minimum =2 bcz, business code = 0306 comes 2 times.
The Problems i am facing
1) Since i have taken the input criteria Business code = 'f0106' ,the data filters in the where condition and the getting the number of cases exist for that business code(f0106) for that Contact of Reason data only.But i have to take all the business code exists for that Particular type of customer for that Particular reason for contact for getting the max,min,avg.
I can't handle max,min,avg in one report since it checks total cases for that Business code only.
SO,I THINK I HAVE TO INVOKE A SUBREPORT PASSING THE C_CUST_TYPE,iSN'T IT????
2) iF I TAKE THESE THINGS IN SUB REPORT,HOW CAN I find out the maximum number of case with in the business codes for reason for contact for that particular customer type.
CONSIDER THE ABOVE EXAMPLES, I AM GETTING 3 CASES FOR CODE = 0306 N 2 RECORDS FOR CODE= 0310 ,hOW CAN I GET mAXIMUM cASES ie 3 BY COMPARING THESE TWO CODES FOR THE DELIVERY TIMING . IS THERE ANY FUNCTION??????
In which way i have to handle this report.
Regards,
Vijay
mail : [email protected]Hi Vijay,
The most efficient way to acheive what you want will be to create a stored procedure or command object in which you have a subquery that calculate your maximum, minimum and average values.
If you are looking at a solution within Crystal Reports without having to write a SQL Query, then as you said, you can use a subreport that will returns the cases created for a particular Reason For Contact for that particular type of Customer.
( You will need to link the subreport to filter the data down )
Then you can calculate the minimum values in the subreport by using the Minimum function and manually counting the values in a variable, the formula will look like:
WhilePrintingRecords;
Shared NumberVar MyMinimum;
If Minimum({Business Code}) = {Business Code} Then
MyMinimum := MyMinimum + 1;
Insert the formula in the details section of the subreport.
This will count the number of time the minimum Business Code appears in the subreport.
You can create a similar formula for the maximum values by using the Maximum function.
As for the average, you can create a summary that counts the number of of Business Code, divided by the distinct count of Business Code, so it will give you the average. The formula will look like:
WhilePrintingRecords;
Shared NumberVar MyAverage;
MyAverage :=
( If DistinctCount({Business Code}) <> 0 Then
Count({Business Code}) / DistinctCount({Business Code}))
Then you can display the above shared variables on your main report.
Hope this help!
Regards,
Patrick -
Problem in Getting Count answer for the report in OBIEE 11g..
Hi friends,
I created a report in OBIEE 11g, but i'm not getting the correct answer as i expected...I'm getting answer in presentation services but the answer is wrong..
I'll explain to you with an example report: Suppose in the report "NATIONALITY COUNT IN DEPARTMENT WISE" manner
i dragged the Nationality column from per_all_people_f which is dim table and i dragged the column that i applied aggregation rule "count" for the column "nation count" from per_all_assignments_f which is fact table......If i viewed answers means i'm getting correct answer
(i.e.) nation count per Nationality..........
NATIONALITY<---------------------->NATION COUNT
AUSTRALIA 40
INDIA 20
AFRICA 10
USA 5
The above is the answer I'm getting with out including the department column from hr_all_organization_units...........
But since according to the report i need count in department wise manner, so for that along with nationality and nation count column i dragged department column from hr_all_organization_units which is dim table and also i hide that column as i dont want to view the department column in answers..........
If i clicked answers, means then I'm not getting the nation count for the nationality......... I'm getting the answer 0 for each and every nationality, if i included the hided department column
NATIONALITY<----------------->NATION COUNT
AFRICA 0
AUSTRALIA 0
INDIA 0
USA 0
I'm getting answers like the above if i include the department dimension column which is in hided manner.........................
What is wrong with it........Whether i made any logical mistake for the report.....If so guide me friends..........
Cheers,
Harry...........Hi,
you said about writing query in DB.......whether U meant of trying checking the query in toad..or something else..........
Since im giving only one join from dim to fact in the physical diagram........
But more than one join exist between those dim and fact, but im giving only one join mainly the primary key column of the dimension table to the fact table....Whether i need to give all the joins that exist(even if it has 2 or 3 joins between those fact and dim) tables....
If i give count distinct means it is giving count for every nation as 1....like i mentioned below
NATIONALITY<----------------------------------------------------->NATION COUNT
INDIA---------------------------------------------------------------------1
AUS------------------------------------------------------------------------1
CAN------------------------------------------------------------------------1
Since you said to check about depts of the particular column....i couldn't able to understand about "depts" that you meant????
Whether i made any logical mistake...........
thanks,
Harry...
Edited by: HariPrasad on Oct 10, 2010 9:55 PM -
How can you get the filter off if you can't remember the password? It's"pro con" and it wont even let me check out the rates for aflight.
You can check the file prefs.js in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder] and remove the line(s) related to that extension (procon.password).
-
Report to get data for current_week+1 till 13th week
Hi Friends,
I have two tables
BACKLOG_WEEK_AFTER_ATP (LE)
BACKLOG_ATP_GT_CW (RE)
** First I have to query whats the current week and year and it should come in this format ---- 2011-WK30
columns in table BACKLOG_WEEK_AFTER_ATP are:
ITEM_NUMBER QUANTITY
1N5418 20
1N5614 30
1N5806SM 10
1N5811 0
2PFF6 60columns in table BACKLOG_ATP_GT_CW are:
ITEM_NUMBER QUANTITY YEAR_WEEK
1N5418 30 2011-WK30
1N5418 5 2011-WK31
1N5614 30 2011-WK32
1N5806SM 30 2011-WK33
1N5811 20 2011-WK32
3EX473K1 20 2011-WK30My report should look like
ITEM_NUMBER 2011-WK30 2011-WK31 2011-WK32 2011-WK33 ...............till 13th week
1N5418 10 -5 -5 -5 ...............till 13t week
1N5614 30 30 0 0 ................till 13th week
1N5806SM 10 10 10 20 ................till 13th week
1N5811 0 0 20 20 ................till 13th week
2PFF6 60 60 60 60 ................till 13th week
3EX473K1 20 20 20 20 ................till 13th weekTo get this report i have these conditions to keep in mind.
1) If item_number not present in LE table and present in RE table then repeat what it is in RE table till 13th week
2) If item_number not present in RE table and present in LE table then repeat what it is in LE table till 13th week
3) If item_number present in LE and also present in RE table then do subtraction for RE - LE for that particular item_number till 13th week.
4) If item_number is there in LE table but not present in RE table for current_week+1(today week comes as 29th week) then repeat the same which is there in LE table. If item is found in RE table for (example 32th week) then subtract RE -LE for that particular item_number
Thanks in advance.
RegardsUser_Apex wrote:
Hi Friends,
I have two tables
BACKLOG_WEEK_AFTER_ATP (LE)
BACKLOG_ATP_GT_CW (RE)
** First I have to query whats the current week and year and it should come in this format ---- 2011-WK30
columns in table BACKLOG_WEEK_AFTER_ATP are:
ITEM_NUMBER QUANTITY
1N5418 20
1N5614 30
1N5806SM 10
1N5811 0
2PFF6 60columns in table BACKLOG_ATP_GT_CW are:
ITEM_NUMBER QUANTITY YEAR_WEEK
1N5418 30 2011-WK30
1N5418 5 2011-WK31
1N5614 30 2011-WK32
1N5806SM 30 2011-WK33
1N5811 20 2011-WK32
3EX473K1 20 2011-WK30My report should look like
ITEM_NUMBER 2011-WK30 2011-WK31 2011-WK32 2011-WK33 ------ till 13th week
1N5418 10 -5 -5 -5 ...............till 13t week
1N5614 30 30 0 0 ................till 13th week
1N5806SM 10 10 10 20 ................till 13th week
1N5811 0 0 20 20 ................till 13th week
2PFF6 60 60 60 60 ................till 13th week
3EX473K1 20 20 20 20 ................till 13th weekTo get this report i have these conditions to keep in mind.
1) If item_number not present in LE table and present in RE table then repeat what it is in RE table till 13th week
2) If item_number not present in RE table and present in LE table then repeat what it is in LE table till 13th week
3) If item_number present in LE and also present in RE table then do subtraction for RE - LE for that particular item_number till 13th week.
4) If item_number is there in LE table but not present in RE table for current_week+1(today week comes as 29th week) then repeat the same which is there in LE table. If item is found in RE table for (example 32th week) then subtract RE -LE for that particular item_numberNot an APEX question: use {forum:id=75} forum.
Query to get data for current week+13 -
Looking for a report to get all managed system components
Hi,
We are looking for a report to get the support pack level of managed system.
We can get that by going individually on each system entry in SMSY. Is there a standard report or a transaction in solution managed that can list the support pack level of all managed systems ?
Thansk you for your help.
ChakHi,
Another option you have -- provided that you are running EarlyWatch Reports on all of your systems -- would be to create a single Service Level Report.
You would create a variant that includes all of your systems under the Select for Reporting column. Then under the Content from Solution Manager tab select the System Configuration --> Select for Reporting box.
This System Configuration report will provide you will the hardware info (OS version, CPU, memory), database version, SAP software components/version, and the SAP kernel.
The SLR allows you to extract and aggregate segments of your EWAs into a single report.
Good luck.
Bill -
How to get the spool id or how to create a spool id for the report .
hi,
how to get the spool id or how to create a spool id for the report .
this spool id i have to use it in CONVERT_ABAPSPOOLJOB_2_PDF fm to get the pdf download file.
my requirement is to download a pdf file from the alv grid list.Hi Raghu,
Execute this program.
REPORT ZTEST_3318 .
tables: usr01.
perform send_report_to_spool.
*& Form send_report_to_spool
text
form send_report_to_spool.
data: loc_dest like pri_params-pdest,
wf_listname type char12,
wf_listtext like PRI_PARAMS-PRTXT,
wf_copies type i,
wf_days type i,
wf_PARAMS LIKE PRI_PARAMS, " achieving file PRI_PARAMS.
wf_valid type c.
clear : wf_listname , loc_dest , wf_listtext .
move: 'AP interface' to wf_listname .
move: 'AP interface' to wf_listtext .
select single spld into usr01-spld from usr01 where bname eq sy-uname .
if sy-subrc eq 0 .
move: usr01-spld to loc_dest .
endif .
call function 'GET_PRINT_PARAMETERS'
EXPORTING
destination = loc_dest
copies = 1
list_name = wf_listname
list_text = wf_listtext
immediately = ' '
release = ' '
new_list_id = 'X'
expiration = 1
line_size = 200
line_count = 65
layout = 'X_65_200'
sap_cover_page = 'X'
receiver = 'SAP*'
department = ''
no_dialog = 'X'
IMPORTING
out_parameters = wf_params
valid = wf_valid.
if wf_valid <> space.
new-page print on parameters wf_params no dialog.
perform write_summary .
new-page print off.
endif .
endform. "send_report_to_spool
*& Form write_summary
text
--> p1 text
<-- p2 text
FORM write_summary .
data: begin of itab occurs 0,
matnr type matnr,
end of itab.
select matnr
from mara
into table itab
up to 10 rows.
loop at itab.
write: / itab-matnr.
endloop.
ENDFORM. " write_summary
This will create spool in SP01.What data you want to put in Spool write it in form write_summary.I have done coding for testing purpose
After that use that spool for your purpose.
If Useful award point
Maybe you are looking for
-
Ipod corrupted and can't connect.
Please can somebody help me. My Ipod isn't detected by itunes when i connect it. Windows detects the ipod, it is all connected properly, i have the latest version of itunes. The problem is that the files on the Ipod are corrupted.Button Reset doesn't
-
Does anyone know how to run an export in background mode for windows ? Normally in unix I would simply nohup the expdp command. Also what is the purpose of being able to reattach to a job in Data Pump - that in itself would suggest the export is alre
-
As default, SPA122 and SPA112 have DHCP Options 66, 160, 159 and 150 turned on. Our pre-provisioning process includes adding our default profile rule to our provisioning server for the device to pull its configuration files once the device has been a
-
Header allignment while broadcasting to portal in PDF format
Hi Guys, I have designed a web template and executed in portal directly it is showing perfect. Headers are at centre, date at top right side. While broadcastin to portal in PDF format it is showing all headers and date at left side. Can any
-
Report with link to file uploaded into database
I have created a form that allows me to upload files into a database table with a blob column. Is it possible to create a report that will have a link to the files / database blob column, so when a user clicks on it, it displays the file.