Hot to select last month sales using fiscal calendar
Hi All,
I have the following query listed below
select DISTINCT
-1,
vODS_GLBalance_test.Page,
vODS_GLBalance_test.FiscalYearId,
vODS_GLBalance_test.FiscalMonthOfYearId,
GLAmount
From ODS.Staging.vODS_GLBalance_Test
Left Outer Join Ods.JJill.tODS_GLBalance
ON tODS_GLBalance.FiscalYearId = vODS_GLBalance_Test.FiscalYearId
AND tODS_GLBalance.FiscalMonthOfYearId = vODS_GLBalance_Test.FiscalMonthOfYearId
AND tODS_GLBalance.Page = vODS_GLBalance_Test.PAGE
where vODS_GLBalance_Test.fiscalyearid = YEAR(GETDATE())
AND vODS_GLBalance_Test.fiscalMonthofyearId = MONTH(GETDATE())-1
The query runs fine and gives me the exact data if we are in lets say 2014 and months > 3.But my issue here is i am using a fiscal calendar and fiscal calendar months is not always MONTH(GETDATE())-1, for ex if we are in feb 2014 then the logic above will
give us Jan 2014 but it should give me jan 2013 as the fiscal year starts from feb and ends in jan.
Can someone please help me with any suggestions?
Thanks.
Hi Naomi,
Thanks for the reply as i was waiting for the answer i tried this one and looks like its working as our calendar month is always +1 of fiscal month
select DISTINCT
-1,
vODS_GLBalance_test.Page,
vODS_GLBalance_test.FiscalYearId,
vODS_GLBalance_test.FiscalMonthOfYearId,
GLAmount
From ODS.Staging.vODS_GLBalance_Test
Left Outer Join Ods.JJill.tODS_GLBalance
ON tODS_GLBalance.FiscalYearId = vODS_GLBalance_Test.FiscalYearId
AND tODS_GLBalance.FiscalMonthOfYearId = vODS_GLBalance_Test.FiscalMonthOfYearId
AND tODS_GLBalance.Page = vODS_GLBalance_Test.PAGE
where vODS_GLBalance_Test.calendaryearid = YEAR(GETDATE())
AND vODS_GLBalance_Test.calendarMonthofyearId = MONTH(GETDATE())
I am not sure if you have remembered but i was struggling with bringing past 3 months sales to update, do you think something of this logic may help us anyway?
Any suggestions please?
Thanks
Similar Messages
-
How to get the same period last year value using Fiscal Calendar?
Hi there,
I am using DAX in a Tabular Model project but I am getting stuck trying to get the following:
We are using a Fiscal Calendar (from 01 April to 31 March).
Previous Period Value
Value
2012
April
15
May
10
Jun
20
2013
April
15
30
May
10
20
Jun
20
25
I have tried to use sameperiodlastyear but there is an error saying that this function cannot be used for non contiguous dates. DATEADD is given the same error...
Could anyone help me getting the right measure expressions for [Previous Period Value]?
Thanks and best regards,
JossHi Joss,
In SQL Server Analysis Services, we can can compare revenue with the hierarchy periods (year, month, day) by using the PARALLELPERIOD function, and now you want to compare with custom periods. (NOTE: We cannot compare it with the PARALLELPERIOD function
since
PARALLELPERIOD function returns a member from a prior period in the same relative position as a specified member. So if the first time span not equal to the second one (such as the first period is 3 days, and the second period is 2 month)). Here
is a sample query about PARALLELPERIOD function for your reference.
with
set Hotels as
[Hotels].[Hotel ID].&[1015],
[Hotels].[Hotel ID].&[5640],
[Hotels].[Hotel ID].&[8800]
set Period as [Arrival Date].[Date].[Month].&[2012]&[1]:[Arrival Date].[Date].[Month].&[2012]&[12]
member [Arrival Date].[Date].[0] as sum({ Period })
member [Total Amount N-1] as (PARALLELPERIOD([Arrival Date].[Date].[Year], 1, [Arrival Date].[Date].[Year].&[2012]), [Measures].[Total Amount])
select
[Measures].[Total Amount],
[Measures].[Total Amount N-1]
} on 0,
nonemptycrossjoin
Hotels,
Hotels.[Hotel].children,
*{[Arrival Date].[Date].[0]}
} on 1
from [Booking_Cube]
Regards,
Charlie Liao
TechNet Community Support -
Fixed Assets Mid-Month rule using non-calendar fiscal months.
Our fiscal year variant is year dependent with twelve posting periods. For example, period 11 for fiscal year 2007 is defined as 29-Oct-07 through 25-Nov-07 and period 12 is defined as 26-Nov-07 through 31-Dec-07.
Fixed Asset depreciation keys MSTL and NA1 use period control 03 (Pro rata at mid-period). Period control 03 is currently not configured in our SAP development system. The IMG help text for Use of Half Months in the Company Code states that You cannot use half periods with non-calendar fiscal months.
How do USA companies configure mid-month depreciation keys (like MSTL and NA1) and mid-quarter depreciation keys when they use non-calendar fiscal months?Mike,
Would be helfpul if you can describe how you resolved the above issue
Thanks. -
SSRS Expression Current month in a Fiscal calendar dimension from a SSAS cube
How to create an expression for a default SSRS parameter to a SSAS cube when using i Fiscal Year calendar - and where I want to show current Calendar month and year (for example February 2014)
This is an example of my Time dimension for February 2014:
[Time].[FiscalYMD].[Fiscal_Year].&[2013].&[10]
The fiscal calendar goes from May - May - which means that April 2014
would look like this:
[Time].[FiscalYMD].[Fiscal_Year].&[2013].&[12]
and May 2014 would look like this:
[Time].[FiscalYMD].[Fiscal_Year].&[2014].&[01]
Please adviseHi HCMJ,
To represent the fiscal calendar, you shift the current date by 4 months back. Then you can do:
="[Time].[FiscalYMD].[Fiscal_Year].&[" & Year( DateAdd( "m", -4, Today() ) ) & "].&[" & Month( DateAdd( "m", -4, Today() ) ) & "]"
It just gets the year and month of '4 months ago'. I have not tested it, but I guess it should work.
Regards
Andrew Borg Cardona -
Which Time variable should use compare this month with last month
We want to calculate the increaed number of employees according to one action reason e.g. Entry to company compare with last month. In this case we have to use time variable in BEx query designer. Now can see 0calmonth has serval variable available.
1) Should we use [0CMLMON] for last month and use offset for this month like [0CMLMON]-1 or [0CMLMON]+1 or use variable [0RSTTCM1], which variable should we use for this month and last month? Do we need to create variables by manually?
2) Then using calculated KF to calculate the increaed number of employees, is this logic correct? If it is wrong, please info.
Edited by: hi ni on Apr 22, 2008 7:58 AMHi,
For the comparison of last 2 months data, you can use two Restricted Key figures with reference to 0CALMONTH and it is better to use only customer exit variable for both RKF's.For the Last month use offset value as -1.
Rgs,
I.R.K -
How many Users did use our Portal in the Last Month?
Hi Community,
just a question. I have to find out how many people in the last month did use our SAP Portal. Is it possible to find this out?
Thanks
Greets
BjoernHi,
The answer you are looking for is [Portal Activity Report|http://help.sap.com/saphelp_nw70/helpdata/EN/58/728ea01cf64fff996b827f2a06f9b1/frameset.htm]
Good Luck!
Sandeep Tudumu -
Routine to capture last month data
Hello Frnds,
For a Dataload from the datasource Actual Cost Component Split(0CO_PC_ACT_10), we want to capture last month data ,
we are planning to write a routine in infopackage level,
using the option 6-ABAP routine, to select the last month data ,
we have the time characteristics 0FISCPER, At present we managing the load by manually changing the selection for last month every time ,
It would be a great help if anybody can show a sample code to select last month data,
Thanks,
satyIf 'last month data' for you is equivalent to 'actual month data', post this code (corrected) into your IPACK dynamic selection:
DATA: zyear type /BI0/OIFISCYEAR,
______zperiod type /BI0/OIFISCPER3,
______zfiscper type /BI0/OIFISCPER.
CLEAR: zyear,
_______Zperiod,
_______zfiscper.
MOVE sy-datum+0(4) to zyear.
MOVE sy-datum+4(2) to zperiod.
concatenate zyear zperiod into zfiscper.
l_t_range-iobjnm = '0FISCPER'.
l_t_range-fieldname = '/BI0/FISCPER'.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
l_t_range-low = zfiscper.
l_t_range-high = zfiscper.
APPEND l_t_range.
Message was edited by: Claudio Caforio -
"Last Month" in RECENT shows a lot more photos than just last month's photo
For some reason when I select "Last Month" in RECENT (on the left) I get a lot more photos than just last month, it seems like just about all the photos from the current year!
Any one else running into this problem?
By the way, my library was originally created using iPhoto '07 and I upgraded when iLife '08 came out.Indeed that is the case but it sounds to me like a bug and not a feature.
I agree - but since this is just a user forum that is all I can do
report to Apple -- iphoto menu ==> Provide iPhoto feedback - they can change it
Larry Nebel -
Previous month sales against each date
Hi all,
I am working on Bo XI 3.0.
I have a requirement where i need to display in table -"Date" then "sales" and against that in the same table "previous month's sales"
For e.x
date sales previous month's sales
01/04/08 45637 63536
02/04/08 73565 78556
and so on..
Any one having any clue please reply .
Thanks in advance,
Gaurav
Edited by: Gaurav Gayawar on May 22, 2009 7:23 PM
Edited by: Gaurav Gayawar on May 22, 2009 7:43 PMHi,
Can you go through the forum which has been answered:
How to calculate "Last Month Sales revnue"
Let me know if this works.
-Madhu. -
Using Fiscal/Year Period to get last year all months data
Hi,
Had a requirement to get Last Years 1-12 months data based on Fiscal/Year Period. So here i am using Fiscal/Year period as my input. Please let me know with code.
Regards,
VishnuHi ,
Where you want to write code ?
Well the basic logic will be like :
TYPES: BEGIN OF ty_range,
sign TYPE c LENGTH 1,
option TYPE c LENGTH 2,
low TYPE c LENGTH 8,
high TYPE c LENGTH 8,
END OF ty_range.
DATA : t_range TYPE TABLE OF ty_range,
w_range LIKE LINE OF t_range.
DATA :v_lastyear type c length 4 .
v_lastyear = sy-datum(4) - 1 .
w_range-sign = 'I'.
w_range-option = 'EQ'.
concatenate v_lastyear '001' t into w_range-low.
concatenate v_lastyear '012' t into w_range-high.
APPEND w_range TO t_range.
****it will select data from source package for last one year .Internally year and period store like YYYYPPP (2011001)
select SOURCE_PACKAGE WHERE 0fiscper IN t_range.
you can modify selection statement as per your requirement .
hope this will be helpful .
Regards,
Jaya Tiwari -
I have an iPad that is now over twelve months old, it doesn't get over used, however in the last few days, it has started to get very hot after only a few minutes use, is this a fixable issue
Is it getting hot only when charging?
Not normal. Take it to an Apple Store for evaluation.
Make a Genius Bar Reservation
http://www.apple.com/retail/geniusbar/
Cheers, Tom -
How to find first and last date of a fiscal week using SQL
Hello,
I want information about FISCAL Week, means a Week based on ISO standard. I know format strings ‘IW’ or ‘IYYY’ gives fiscal week and fiscal year respectively from a given date. But I want to find the first and last date of a fiscal week. Say suppose I have a fiscal week is 2, and fiscal year is 2008, how to find the start and end date of the given fiscal week.
Any kind of help would be greatly appreciable.
Thanks,
Princedavide gislon wrote:
The following query evaluate the begin of a fisical week, where &year and &week are respectively the year and week you want to calculate.
To evaluate the end of the week you have to add 6.
Note that my database is set to have monday as day number 1 of the week, and sunday as day number 7; if your database settings are different you should modify the query accordingly.
SELECT CASE TO_CHAR(TO_DATE('&year','YYYY'),'D')
WHEN '1' THEN TO_DATE('&year','YYYY')+((&week-1)*7)
WHEN '2' THEN TO_DATE('&year','YYYY')+((&week-1)*7-1)
WHEN '3' THEN TO_DATE('&year','YYYY')+((&week-1)*7-2)
WHEN '4' THEN TO_DATE('&year','YYYY')+((&week-1)*7-3)
WHEN '5' THEN TO_DATE('&year','YYYY')+((&week-1)*7+3)
WHEN '6' THEN TO_DATE('&year','YYYY')+((&week-1)*7+2)
WHEN '7' THEN TO_DATE('&year','YYYY')+((&week-1)*7+1)
END BEGIN_FISICAL_WEEK
FROM DUAL
Hope this is helpful.
Cheers,
Davide
Edited by: davide gislon on 08-Jan-2009 07:19Your query does nothing you say it does. TO_DATE('&year','YYYY') returns first day of the current month for year &year. And the only reason it returns January 1, &year is that we are currently in January:
SQL> select TO_DATE('&year','YYYY') from dual
2 /
Enter value for year: 2005
old 1: select TO_DATE('&year','YYYY') from dual
new 1: select TO_DATE('2005','YYYY') from dual
TO_DATE('
01-JAN-05
SQL> As soon as we roll into February:
SQL> alter system set fixed_date = '2009-2-1' scope=memory
2 /
System altered.
SQL> select sysdate from dual
2 /
SYSDATE
01-FEB-09
SQL> select TO_DATE('&year','YYYY') from dual
2 /
Enter value for year: 2005
old 1: select TO_DATE('&year','YYYY') from dual
new 1: select TO_DATE('2005','YYYY') from dual
TO_DATE('
01-FEB-05
SQL> alter system set fixed_date = NONE scope=both
2 /
System altered.
SQL> select sysdate from dual
2 /
SYSDATE
08-JAN-09
SQL> But even if TO_DATE('&year','YYYY') would always return January 1, &year, or you would fix it to TO_DATE('0101&year','MMDDYYYY') it still would be wrong. ISO week rules are
If January 1 falls on a Friday, Saturday, or Sunday, then the week including January 1 is the last week of the previous year, because most of the days in the week belong to the previous year.
If January 1 falls on a Monday, Tuesday, Wednesday, or Thursday, then the week is the first week of the new year, because most of the days in the week belong to the new year.Therefore, next year:
SQL> DEFINE YEAR=2010
SQL> DEFINE WEEK=1
SQL> ALTER SESSION SET NLS_TERRITORY=GERMANY -- enforce Monday as first day of the week
2 /
Session altered.
SQL> SET VERIFY OFF
SQL> SELECT CASE TO_CHAR(TO_DATE('0101&&year','MMDDYYYY'),'D')
2 WHEN '1' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7)
3 WHEN '2' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-1)
4 WHEN '3' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-2)
5 WHEN '4' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7-3)
6 WHEN '5' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+3)
7 WHEN '6' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+2)
8 WHEN '7' THEN TO_DATE('0101&&year','MMDDYYYY')+((&&week-1)*7+1)
9 END BEGIN_FISICAL_WEEK
10 FROM DUAL
11 /
BEGIN_FI
04.01.10
SQL> SELECT TRUNC(TO_DATE('0101&&year','MMDDYYYY'),'IW') FROM DUAL
2 /
TRUNC(TO
28.12.09
SQL> 2 user10772980:
Use:
SELECT TRUNC(TO_DATE('0101&&year','MMDDYYYY'),'IW') + (&&week-1)*7 FISCAL_YEAR_&&YEAR._WEEK_&&WEEK
FROM DUAL
FISCAL_YEAR_2010_WEEK_1
28.12.09
SQL> SY. -
Hi loading last 2 months data using abap routine
we are planning to write a routine in infopackage level,
using the option 6-ABAP routine, to select the last 2 month data ,
we have the time characteristics 0CALMONTH, At present we managing the load by manually changing the selection for last 2 month every time ,
It would be a great help if anybody can show a sample code to select last 2 month data,
Thanks,Hi,
data: l_idx like sy-tabix.
DATA: lv_calmonth LIKE /BI0/SCALMONTH-CALMONTH.
DATA: lv_day TYPE DATS.
"previous month
lv_day = SY-DATUM.
lv_day+6(2) = '01'.
lv_day = lv_day - 1.
lv_calmonth = lv_day(6).
READ TABLE l_t_range with key fieldname = 'CALMONTH'.
l_idx = sy-tabix.
MOVE lv_calmonth TO l_t_range-low.
MODIFY l_t_range INDEX l_idx.
"previous month - 1
lv_day+6(2) = '01'.
lv_day = lv_day - 1.
lv_calmonth = lv_day(6).
MOVE lv_calmonth TO l_t_range-low.
APPEND l_t_range.
p_subrc = 0.
let me know if this works.... not sure about the last append.
Olivier. -
How to get the sales value of the last month in the quarter
Hi,
We have a requirement to get the "Sales" value against a quarter. We have 2 tables "Time" and "Sales". We want to display the Sales value against each quarter.
But this should happen as follows.
Consider quarter Q1 it should display the value of 3rd month, Q2 should display value for 6th month and so on..
If in any particular Quarter we dont have a value for last month then it should display the value for 2nd month, if 2nd month value is also not present then it should display 1st month sales value.
We are using excel as the database.
Please let us know if anybody has a resolution to this.
Regards,
Apoorv Chitrehi,make an other column which will be the flag for the last months you want to be displayed...
so ,in reports,you pass it as hidden column(by filter only the ones which have the appropriate flag),and then voila...
i hope i helped
http://greekoraclebi.blogspot.com/
/////////////////////////////////////// -
IMPORTANT! ZXRSAU01 for 0FI_GL_40-Select closed period-last month on BUDAT
Hello Everybody,
I want to use Exit: ZXRSAU01 for 0FI_GL_40 : I need to Select data on closed period (last month) in ECC for BI7, with field BUDAT.
Please, did somebody have any ABAP Code to do this?
Thanks in advance.so, i don't know how to determine the last month, but if you know this your coding should look like this:
field-symbols: <fld> type extractstructure of Datasource (you find the extractStructure in RSA6 when ds is activated)
data: lc_tabix type sytabix.
data: budat_low type sydatum,
budat_high type sydatum.
.... here you have to determine low and high date for your period you want to select...
case i_datasource.
when '0FI_GL_40'.
loop at c_t_data assigning <fld>.
lc_tabix = sy-tabix.
if not <fld>-budat between budat_low and budat_high.
delete c_t_data index lc_tabix.
endif.
endloop.
endcase.
So somewhere you have to determine the month you want to bring to BW.
But remember - its not a good idea to select data first and then delete it in this exit. The better way would be not to select them with selection in you Infopackage.
Br
M.
Maybe you are looking for
-
R6034 error Photoshop CS2 drag & drop
I've had this problem for some time. I'm on Vista-64-SP2 running Photoshop-CS2 When first installed PS-CS2 worked fine. I got no errors when starting the program and I could drag & drop icons from the desktop or windows onto the Adobe taskbar icon a
-
Do I 'need' an audio interface on modern Macs?
Hi there Don't think I've posted on here in nearly 10 years but I'd be really glad of some help. I currently record on a 2003 eMac running 10.3.9 using Garageband 06. I record directly into the audio in via a tube preamp. I am considering finally upg
-
Out of the Box Thanker Help!
I have leased a cable channel for airing local news and events. We currently have a multi disc DVD player connected to the cable company modulator for our channel. We Final Cut edit our programing and compile a 2 hour DVD of our programing, either in
-
Can't open pdf file on browser explorer 11
I have a problem on one of our customers pc's. it can't open pdf files on explorer browser. another user has the same problem, so all the solutions must be other then u can see here: Reader XI PDF Reader Display in browser does not work thanks shay
-
Readind Data From ID/IF Clusters (PU12)
Hi, I want to read data from Clusters ID and IF of table PCL2, they store historical data of PU12 Interface Toolbox. The macro that I will be using is rp-imp-c2-id, I am not sure how to interpret the data stored in clustd field? Does anybody know FMs