Sales report for current month and year a go month
i could you please guide me builting report for current monthwise for current month and year a ago month
report parameter month_year='06-2010'
tables = sales and below are the table fields
customer_id
invoice_dt
invoice_am
thanks
nhm
Okay, Still you did not mention how you will pass value in report while generating.
Anyway the query with UNION ALL will work. For Example.
I am assuming that the parameter for date/month you will pass in range like 01-JUN-2010 to 30-JUN-2010
SELECT customer_id, SUM(curr_value) curr_value, SUM(past_value) past_value
FROM
SELECT customer_id, NVL(SUM(invoice_amount),0) curr_value, 0 past_value
FROM sales
WHERE invoice_dt BETWEEN :P_FROM_DATE AND :P_TO_DATE -- here P_FROM_DATE and P_TO_DATE will be the date range for current year as i showed above.
AND -- Any Condition goes here...
GROUP BY customer_id
UNION ALL
SELECT customer_id, 0, NVL(SUM(invoice_amount),0)
FROM sales
WHERE invoice_dt BETWEEN ADD_MONTHS(:P_FROM_DATE,-12) AND ADD_MONTHS(:P_TO_DATE,-12) -- This add_months function for the previous year same month.
AND -- Any condition goes here...
GROUP BY customer_id
GROUP BY customer_idNow using the above query you can design the tabular report as you showed the format.
-Ammad
Edited by: Ammad Ahmed on Jul 3, 2010 7:55 PM
added GROUP BY
Similar Messages
-
How to fetch year till date value for earning for current ,last and year
hi,
how to fetch year till date value for earning for current ,last and year before that from payroll result
plz reply soon,
pratyushDear Pratyush,
Pick this from CRT.
Use LDB PNPCE & Fire event GET PAYROLL &
then you can pick from CRT.
Hope this helps.
Kindly reward in case useful.
Regards & Thanks,
Darshan Mulmule -
Report for current day and current month
Hi gurus,
i 've a report, where i 've to display the values for qty and cost of the material for the current day and current month
HOw can i do this in BEx Query designer..If any document plz share
thanks
rakeshhi Kolli
here i want to filter the data on system date,
i wnt the report to pick the date dynamically based on the system date.
but i think restricting on calmonth and calday is not going to solve my scenario..
rakesh -
Set Parameter to pick up previous month and year unless first month of the year
Hi,<o:p></o:p>
I have a start and end date set to the same format (CCYYMM) and date.<o:p></o:p>
I am running a report each month using the below expression.<o:p></o:p>
=Year(Today()) * 100 + Month(Today().AddMonths(-1))<o:p></o:p>
This functions correctly except when the report is run in January where the date returned is 201512 instead of 201412.<o:p></o:p>
Can someone advise of how i can get this expression to show the correct month when i run this in January?
M Stoker=Format(DateAdd(DateInterval.Month,-1,Today()),"yyyyMM")
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Inventory Report for current stock and Safety, Minimum etc stock levels
Hi,
Is there any report available to view the current stock against the minimum, safety stock levels so that the user can plan further actions accordingly. Can anyone please guide me on this.
Thanks in Advance.
Regards,
LaxmiHi Shailesh,
Is there any way we can include some extra fields into this MC.9 report - i tried but could not find anything. Can you please help.
Regards,
Laxmi -
SELECTION SCREEN FIELD FOR MONTH AND YEAR
Hi All.
We are developing a 'Monthly Sales Tax(payable) Report.
they want the report based on the date(in the selection screen it will come only month and year only.).Depends on that month and year for that select-options ,it will pick up the record.
like if, jan 2005 to march 2006.
then it will pick up from 01.01 .20005 to 31.03.2006 records.
Can any body help me to resolve this.
Thanks in advance,
Regards,
VenkatHi Venkat,
Copy the following code.
DATA : ws_billfrom TYPE dats,
ws_billto TYPE dats.
DATA : mon TYPE fcltx.
SELECT-OPTIONS: s_month FOR mon
MATCHCODE OBJECT zsdhtch_sh_mnth
OBLIGATORY. "o get values for F4
PARAMETER : p_year LIKE bkpf-gjahr
MATCHCODE OBJECT zsdhtch_sh_year
OBLIGATORY.
RANGES : s_date FOR sy-datum.
DATA : ws_fcmnr TYPE fcmnr.
START-OF-SELECTION.
SELECT SINGLE mnr
INTO ws_fcmnr
FROM t247
WHERE ltx = s_month-low.
CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = ws_billfrom
IMPORTING
ev_month_begin_date = ws_billfrom
ev_month_end_date = ws_billto.
s_date-low = ws_billfrom.
s_date-high = ws_billto.
s_date-sign = 'I'.
s_date-option = 'BT'.
IF NOT s_month-high IS INITIAL.
SELECT SINGLE mnr
INTO ws_fcmnr
FROM t247
WHERE ltx = s_month-high.
CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = ws_billfrom
IMPORTING
last_day_of_month = ws_billto.
s_date-high = ws_billto.
ENDIF.
APPEND s_date.
WRITE s_date.
You can write your select statement here.
select * from dbtable where date in s_date.
If 'HR_JP_MONTH_BEGIN_END_DATE' is nto there in your server, you can use 'RP_LAST_DAY_OF_MONTHS' in both cases.
Regards,
Susmitha.
Dont forget to reward points for useful answers -
Monthly and Yearly backups not working for Protection Group?
Hi
We have a Protection Group with 160 members currently attached to it. The group has the following customized Recovery Points:-
- 1 recovery point every 1 day for the last 2 weeks, 1 recovery point every 1 month for the last 60 months and 1 recovery point every year for the last 5 years.
The schedule is as follows:-
- Every Day at 01:00, Every Month on First Day at 01:00 and Every 12 Months on 01 January at 01:00.
The daily tape backups are working fine without issue but neither the Monthly or Yearly backups are being attempted. We have checked the monthly backups for this issue for the last few months and are unable to see any evidence of the Monthly schedule even
running? This means that we are having to manually label the Daily tapes once a month as Monthly tapes but they will then stay on the Reports for the next 5 years as DPM will constantly request these tapes back.
Are you able to help with this matter?
Not that we really want to do this but if we removed the group completely and re-create it would this cause problems with our restore points?Hi,
This is a known issue that can occur in all current versions of
DPM including DPM 2012, to correct the condition, you simply need to perform this step. Any time before the next scheduled (monthly or longer) backup, manually update
the long term backup schedule by hitting the MODIFY button. The code that runs when modifying the backup schedule redoes the bacup schedules and it fixes the scheduling issue.
Below is a DPM Power-shell script that will show you the scheduled backups for all recovery goals for all protection groups. You can see the last time each recovery goal ran, and the NEXT run time, so you can monitor
the goals and re-fix them if necessary.
NOTE: It takes about 20-30 minutes before the fixed next run time schedule will be populated after modify the protection group and updating the schedule.
# This script will list all currently scheduled backup to tape jobs #
# It will list scheduled, last run and next run dates #
# Note: The script takes in consideration that the DPM Database was installed locally on its #
# Default instance. If SQL is installed on a different location/instance, edit the line #
# that starts with $instance = '.\msdpm2010 #
# Author : Wilson Souza #
# Date Created : 1/13/2012 #
# Last modified : 1/17/2012 #
# Version : 1.0 #
# This version of the script was only tested on DPM 2010 #
param([string] $verbose)
add-pssnapin sqlservercmdletsnapin100
Add-PSSnapin -Name Microsoft.DataProtectionManager.PowerShell
$ConfirmPreference = 'None'
cls
$instance = '.\msdpm2010' # <---- If DPM Database is on a different location, edit this line accordinly
$query = "use DPMDB
go
CREATE FUNCTION label (@GUID varchar(36), @kindred varchar(4), @vault varchar(8))
returns varchar (1024)
as
Begin
declare @result varchar (1024)
select @result = vaUltlabel from tbl_mm_vaultlabel where mediapoolid = @GUID and generation =
case @kindred
when 'Fath' Then '2'
when 'Gran' then '1'
when 'grea' Then '0'
end and
vault =
case @vault
when 'Offsite1' then '3'
when 'Offsite2' then '4'
when 'Offsite3' then '5'
when 'Offsite4' then '6'
when 'Offsite5' then '7'
when 'Offsite6' then '8'
when 'Offsite7' then '9'
else
'1'
end
RETURN @result
END
go
use DPMDB
select ScheduleId as name
,def.JobDefinitionId as JD
,FriendlyName as PG
,SUBSTRING (CONVERT(VARCHAR(10),active_start_date),5,2) + '-' + SUBSTRING (CONVERT(VARCHAR(10),active_start_date),7,2) + '-' + SUBSTRING (CONVERT(VARCHAR(10),active_start_date),1,4) as SD
,jobs.date_created as SCD
,SUBSTRING (CONVERT(VARCHAR(10),last_run_date),5,2) + '-' + SUBSTRING (CONVERT(VARCHAR(10),last_run_date),7,2) + '-' + SUBSTRING (CONVERT(VARCHAR(10),last_run_date),1,4) + ' ' +
SUBSTRING (CONVERT(VARCHAR(6),last_run_time),1,2) + ':' + SUBSTRING (CONVERT(VARCHAR(6),last_run_time),3,2) + ':' + SUBSTRING (CONVERT(VARCHAR(6),last_run_time),5,2) as LRD
,SUBSTRING (CONVERT(VARCHAR(10),next_run_date),5,2) + '-' + SUBSTRING (CONVERT(VARCHAR(10),next_run_date),7,2) + '-' + SUBSTRING (CONVERT(VARCHAR(10),next_run_date),1,4) + ' ' +
SUBSTRING (CONVERT(VARCHAR(6),next_run_time),1,2) + ':' + SUBSTRING (CONVERT(VARCHAR(6),next_run_time),3,2) + ':' + SUBSTRING (CONVERT(VARCHAR(6),next_run_time),5,2) as NRD
,dbo.label ((substring(xml,(patindex('%MediaPoolId%',Xml))+13,36)), (substring(xml,(patindex('%generation%',Xml))+12,4)), (substring(xml,(patindex('%vault%',Xml))+7,8))) as TL
,case
when substring(xml,(patindex('%vault%',Xml))+7,3) = 'off' then 'Long-Term'
else 'Short-term'
end as STLT
,case
when substring(xml,(patindex('%generation%',Xml))+12,4) = 'Fath' then 'Recovery Goal 1'
when substring(xml,(patindex('%generation%',Xml))+12,4) = 'Gran' then 'Recovery Goal 2'
when substring(xml,(patindex('%generation%',Xml))+12,4) = 'Grea' then 'Recovery Goal 3'
end as RG
from tbl_SCH_ScheduleDefinition sch
,msdb.dbo.sysjobs jobs
,tbl_JM_JobDefinition def
,DPMDB.dbo.tbl_IM_ProtectedGroup prot
,msdb.dbo.sysjobschedules jobsch
,msdb.dbo.sysjobsteps jobsteps
,msdb.dbo.sysschedules syssch
where CAST(sch.ScheduleId as NCHAR (128)) = jobs.name
and def.JobDefinitionId = sch.JobDefinitionId
and def.ProtectedGroupId = prot.ProtectedGroupId
and jobs.job_id = jobsch.job_id
and jobs.job_id = jobsteps.job_id
and jobsch.schedule_id = syssch.schedule_id
and (def.Type = '913afd2d-ed74-47bd-b7ea-d42055e5c2f1' or def.Type = 'B5A3D25C-8EB2-4032-9428-C852DA5CE2C5')
and sch.IsDeleted = '0' and def.ProtectedGroupId is not null
order by FriendlyName, next_run_date, next_run_time
go
drop function label
go"
$result = Invoke-Sqlcmd -ServerInstance $instance -Query $query
$count = 1
write-host " The list below shows all scheduled backup to tape jobs (short term and long term)" -f green
write-host
if ($verbose.ToLower() -eq '')
write-host " For optimun output, set PoweShell Width for screen buffer size to at least 200" -f yellow; write-host
write-host
write-host " Protection Group name Creation Date [Schedule Creation Date] [Last Run Date / time] [Next Sched Run Date/time] Goal type Recovery Goal # Custom Tape Label"
write-host " ------------------------------ ------------- ------------------------ ---------------------- -------------------------- ---------- --------------- -----------------"
foreach ($result1 in $result)
if ($color -eq 'white') {$color = 'cyan'} else {$color = 'white'}
write-host ("{0,2}"-f $count) -foreground green -nonewline
write-host ( " - {0,-30} {1,-13} {2,-24} {3,-24} {4,-27} {5,-10} {6,15} " -f $result1.PG, $result1.SD, $result1.SCD, $result1.LRD, $result1.NRD, $result1.STLT, $result1.RG) -nonewline -f $color
write-host $result1.TL -f yellow
$count++
else
write-host " For optimun output, set PoweShell Width for screen buffer size to at least 110" -f yellow; write-host
write-host " Protection Group Term Goal Tape Label"
write-host " ------------------------------ ---------- --------------- --------------"
foreach ($result1 in $result)
if ($color -eq 'white') {$color = 'cyan'} else {$color = 'white'}
write-host ("{0,2}"-f $count) -foreground green -nonewline
write-host ( " - {0,-30} {1,-10} {2,15} " -f $result1.PG, $result1.STLT, $result1.RG) -nonewline -f $color
write-host $result1.TL -f yellow
$count++
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Mike J. [MSFT] This
posting is provided "AS IS" with no warranties, and confers no rights.
I cant seem to get this script to run.. can someone point out what might be missing..
I've tried creating a shortcut like the following as well:
Target: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -File "C:\Program Files\Microsoft
DPM\DPM\bin\dpmcliinitscript.ps1" "C:\Data\scripts\scheduledjobs.ps1"
Start in: "C:\Program Files\Microsoft DPM\DPM\bin\"
If i run as admin in just takes you to a command line prompt in PS..
Any thoughts on what is missing here.. i've modified the ps1 to reflect 2012 in my case.. 2012 R2
DPM
Tech, the Universe, Everything: http://tech-stew.com
Ok, the 1.6 script works.. but only if i run it from the ps1 script file.. by right clicking it and doing the Run with Powershell option (non admin).. my shortcut doesnt work.. same issue.. it just goes to a power shell prompt. The right click and
run is non admin mode as well.
When I run it with the right click it shows no jobs scheduled.. If i look in dpm 2012 r2 i see a yearly tape backup scheduled for today.. the script doesnt show me a way to also get the monthly to appear (i've set the monthly for a day later but it doesnt
appear in the scheduled tasks for next 7 days).. i was under the impression this script would help force the monthly to appear/run.. but even the yearly that does show in DPM scheduled tasks isnt showing up with the script (maybe admin issue?)
Tech, the Universe, Everything: http://tech-stew.com -
List of Month and Year in SSRS report parameter?
Hi, I have two parameters in my SSRS Report i.e. Month and Year. I want to show the list of all Months in dropdown and years for a particular range say 1995-Current Year.
Can any one suggest me the query for how to get it to work.Thanks!!
MCPI am not sure I what you're business needs are for this report. You stated that you need the month and year for parameters. If this is the case then there has to be a date and time column in which you can query against to provide both the month(s) and year. In order to accomplish this using t-sql without querying an existing column would require a loop or cursor based approach,which can negatively impact performance, or a union statement specifying a string literal and the effort to write either of these would exceed the effort required to statically assign the parameter values in reporting services. The below query shows how to statically create a query for each month and its ordinal position in the year and the same could be done with the year(s) 1995-2009, but this process involves more resources than assigning the static values for the parameters
SELECT DATENAME(MONTH, 1 ) AS MONTH,
1
UNION
SELECT DATENAME(MONTH, 2 ) AS MONTH,
2
UNION
SELECT DATENAME(MONTH, 3 ) AS MONTH,
3
UNION
SELECT DATENAME(MONTH, 4 ) AS MONTH,
4
UNION
SELECT DATENAME(MONTH, 5 ) AS MONTH,
5
UNION
SELECT DATENAME(MONTH, 6 ) AS MONTH,
6
UNION
SELECT DATENAME(MONTH, 7 ) AS MONTH,
7
UNION
SELECT DATENAME(MONTH, 8 ) AS MONTH,
8
UNION
SELECT DATENAME(MONTH, 9 ) AS MONTH,
9
UNION
SELECT DATENAME(MONTH, 10) AS MONTH,
10
UNION
SELECT DATENAME(MONTH, 11) AS MONTH,
11
UNION
SELECT DATENAME(MONTH, 12) AS MONTH,
12
David Dye -
Daily, Monthly, and Yearly Report
Hi I am new to the BAM. I have a BPM process. I want to generate the daily, monthly and yearly report for it. Please advise how can I achieve it. I have a one dimension variable on the process.
Thanks in advance!Hi,
Try this query to get default ware house and its quantity and modify above query.
SELECT T0.[ItemCode], T0.[WhsCode], T0.[OnHand] FROM OITW T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode WHERE T0.[WhsCode] = T1.[DfltWH] and T1.[ItemCode] = [%0]
Thanks & Regards,
Nagarajan -
Table for Material Quantity and Value for particular month and year
Hi All
My requirement is that for a particular month and year I want to know the stock quantity and stock value for a particular material for a given plant.From which SAP table can I get this data as I want to fetch data for my Y report?
Regards
Satish KumarHi,
You can use MB5B table as suggested earlier.also you can use:
MBEW-VMKUM --> stock for previous month period
MBEW-VJKUM --> stock for previous year period
PLease view these links which migh tbe helpful to you:
http://help.sap.com/saphelp_47x200/helpdata/en/39/55fee3bc6111d4b3960050dadf0791/content.htm
TableStock
Thanks
Nisha -
How to set filter criteria for month and year using in timestamp input field?
Hi,
I am using jdev 11.1.2.3,
I have one problem with Report generation,,,,,,I have one report table which is in the form of VO(query based) and i want to search this table as month and year basis
but in this table(query) that field having timestamp based value.. how to search with month name and year only.. Here i am using totally query base VO's for generating
reports........ Can any one guide me.
Thank You.You can use a inputdate, which allows you to selecte a moth, year and a day. Once the selection is made you convert it to only allow moth and date like
<af:inputDate label="Label 1" id="id1" autoSubmit="true" value="#{bindings.myMonthYear1.inputValue}">
<f:convertDateTime pattern="MM/yyyy"/>
</af:inputDate>
<af:outputText value="Selected #{bindings.myMonthYear1.inputValue}" id="ot1" partialTriggers="id1"/>
then you have a string holding month and year only. This value you split into two variables you or pass it as a whole parameter to the query and split it there.
Another way is to add two static lovs one for month and one for year and use them to get to the filter values.
Timo -
Creation of a Query to show the values for the current month and the last 12 months data.
Dear All,
Good day!
I have to create a Query with the below requirement.
I have to create a Query to show the values for the current month and the last 12 months data.
Can you please guide me how to achieve this ??
thank you,
Regards,
HemaHema
explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
for some more hints..
http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
http://scn.sap.com/thread/3217381
search on SDN you will get many other ways..
Thanks,
Bhupesh -
First month and year relevancy for COI
When transferring the data from legacy system to ECC/BCS system, what is the context in the Year and period of first data entry will help the COI process.
Suppose the go live is on Jan 2008, is it put the first month and year as 001,2008.
How this impacts BCS ,particularly COI functionality in future if the data of starting in BCS as first month and year.
How does this impact the future execution of the function.Venkat,
do you mean Year & Period of 1st Collection fields in the Companies screen?
If yes, then the answer is very easy. If you have clicked on the 1st field description and then press F1, you would get the following help:
Year of First Data Collection
Attribute of the consolidation unit, which specifies the first period for which reported financial data can be entered or collected for that consolidation unit.
You are able to record reported financial data in the period of first entry and the year of first entry, even if posting and entry is blocked.
Dependencies
In customizing of consolidation units, you specify the year of first entry along with the period of first entry.
Regarding the periods.
I usually start customization in the period that is definitely earlier than go-live period.
Because:
1. I need to upload beginning balances. Usually I do this upload in the last periods of the year prior to go-live. -- in order to make balance carryforward.
2. In case of CoI I need to post and consolidate the history of capital. In periods prior go-live.
Edited by: Eugene Khusainov on Apr 25, 2008 8:54 AM -
Needing a multi-month and year-in-view option for ical!
Hello all!
I could really use a multi-month and year-in-view format in ical... I've seen some dated posts - is anyone aware of any new developments/options for this?
thanks and peace-
DWI turn off all calendars but the birthdays. Select [Print]. Choose all the months you want to see. Deselect all calendars but birthdays. Click [Continue]. On the next menu, go to "Layout", select how many pages to print on the paper. I usually print a border around each calendar then you're good to go!
By only printing the birthdays calenar, you won't get too many appointments to get in the way of brain storming and future planning, yet the computer still thinks its printing a useful calendar. -
Data element for Month and Year
Hello All,
Is there any data element which will have only Month and Year.
I have to introduce this field in a table. It should have convesion exits also.
Ex: If i give 092009, it sould come like 09.2009
Thank you.
Best Regards,
Sasidhar Reddy Matli.Kindly Try this code for Month and year as input and having standard F4 help..
INCLUDE RMCS0F0M.
TYPES : BEGIN OF TY_SELECT,
MONTH TYPE FTI_MONTH_YEAR,
END OF TY_SELECT.
DATA : WA_SELECT TYPE TY_SELECT.
SELECTION-SCREEN : BEGIN OF BLOCK SANDEEP WITH FRAME.
SELECT-OPTIONS : S_MONTH FOR WA_SELECT-MONTH OBLIGATORY NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN : END OF BLOCK SANDEEP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH-LOW.
PERFORM MONAT_F4.
SANDEEP JAIN
Maybe you are looking for
-
How can I get my iPod Touch 5G recognized in iTunes 11.0.2?
I got the iPod Touch 5 recently and I could not wait to put my favorite music in there so i plugged it to my MacBook Pro and for some reason, it doesn't recognize it on iTunes 11.0.2. But it is only recognized in iPhoto. If someone could please help
-
Been using encore for a long time for burning finished 720x480 dvds. It's HD time and now when importing my adobe media encoded H264 1920x1080 project in encore, after completion and building to burn I find I cannot shut off the automatic transcode s
-
Hello, I have a user that had hyperion in their excel menus, but it went away. Usually unregistering hsaddin, hsspread and hyperionsmarttag and then reregistering them corrects the problem. But that is not working for this person. Any ideas? Thanks R
-
Can't get Windows update to download updates for other MS products
Hi, Installed W7 Home Premium on a single system and for one or another reason I cannot get Windows Update to download updates for other Microsoft products. MS Office University 365, MS Visual Studio Pro 2013 and Microsoft Expression are also install
-
Lumia 520 Unable find bootable option. Press any Key to shut down
I am facing this error on my Lumia 520 phone it suddenly went blank & a message is popping up "Unable to find bootable option. Press any Key to shut down" Please help what is this issue.