Calculate 12 previous months by ASO
Hi all
I need to create members in the dimension based on the last 12 months period. As below
MemberA = Jan2013 + Dec2012 + Nov2012 +... + Feb2012
MemberB = Dec2012 + Nov2012 +... + Feb2012 + Jan2012
MemberC = Nov2012 +... + Feb2012 + Jan2012 + Dec2011
etc...
We must separate the year and time dimensions. Here is the hierarchy
Year
2013
2012
Period
1ST QUARTER
Jan
Feb
Mar
Q2
Apr... etc.
Can you please help me achieve this goal.
Thank you
Alain
Solved this problem with the below, not sure this is correct or not, how but its not working
CASE
WHEN (IS ([FY13], [YEARS]. CURRENTMEMBER)) and (ISLEVEL ([period].) Jan, 0))
THEN together ({[period]. {- Jan.Lag (1): [Dec]}, [years]. [FY12]) + Aggregate ({[Period]. Jan}, [years]. [FY13])
WHEN (IS ([FY12], [YEARS]. CURRENTMEMBER)) and (ISLEVEL ([period].) Jan, 0))
THEN together ({[period]. {- Jan.Lag (1): [Dec]}, [years]. [FY11]) + Aggregate ({[Period]. Jan}, [years]. [FY12])
WHEN (IS ([FY11], [YEARS]. CURRENTMEMBER)) and (ISLEVEL ([period].) Jan, 0))
THEN together ({[period]. Jan}, [years]. [FY11])
END
Thank you
Alain
Tags: Business Intelligence
Similar Questions
-
Calculate the previous three months
I want to calculate the past 3 months on the basis of sysdate in 3 separate columns. I get the previous month by executing the following SQL statement:
The current month is July, then how can I get 05, 04 as output.select EXTRACT(MONTH FROM TRUNC(SYSDATE,'MONTH')-1)mn1 from dual
YogeshHello
Just remove TRUNC...
select EXTRACT(MONTH FROM (SYSDATE))-1 mn1,EXTRACT(MONTH FROM (SYSDATE))-2 mn2,EXTRACT(MONTH FROM (SYSDATE))-3 mn3 from dual;
AJ
-
Difficulty accessing data by using the function of Ago - the end of the previous month
Hey,.
Recently, I met a problem that I can't fix on my own.
I need to compare my portfolio to the current date / specified with the portfolio for intelligence and for the end of the previous month (the last day of the previous month).
It looks like this :
My fact table consists of the list of contracts of loan that is updated daily. The data for the new day are added to the table, which actually resemble a large sandwich of various portfolios.
To recover the data for the current/specified date and intelligence is not a problem. Current date - the date is read (can 10.08.2014), the day before - I use the Ago function (e.g., 09.08.2014).
The real problem is getting the data for the last day of the month previous (e.g. 31.07.2014), since I can't put a specific to the function of Ago offset (10 days in our example), as the number of days from the end of the previous month is constantly - changing is a daily report.
The best solution would be setting the offset function there is a dynamic value, which would change according to the user selects the date of the report. Can be based on the number of days in the month. BI strictly prohibits using anything that is not an integer in the offset value, so this isn't an option.
I tried a work around using formulas in columns, like: FILTER ('facts of agreements'. "" Outstanding "USING ("Posting Date". "" Id of the day ' = TIMESTAMPADD (SQL_TSI_DAY, TIMESTAMPADD (1), (SQL_TSI_DAY, 'Date of Report'.) "Number of the day in the month" *-(1) + 1, DATE ' @{report_date}'))). "
It did not work, since the data I receive are dated the last day of the previous month and date, which is applied to get the data for the current date filter / specified, it cuts.
Tried to create another time the hierarchy, with the ends of period (week, month, quarter, year) and use it as a level at the Ago. He does work in part, offset the end of 1 month, but I can't bind the data, I get to the date of the report, as the Ago function returns random dates.
I tried to search if people have had the same problems and it seems I'm the only one. I'm really desperate at this point, not even sure it's possible to get the result I need everything.
So, please advise!
Aurore
Finally got sorted! Hoorey!
Here's how it's done:
I created a presentation variable 'report_date' for the user to choose the date of the desired report. That this formula has added to the column:
FILTER ('facts of agreements'. "" Outstanding "USING ("facts of agreements". (("" Days late max "> 30))-there is (FILTER ('facts of agreements'. "" Outstanding "USING ("facts of agreements". ((("" Days late max "> 30)), TIMESTAMPDIFF (SQL_TSI_DAY, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH (DATE ' @{report_date}') *-1, DATE ' @{report_date}" "), DATE ' @{report_date}'))
Basically, this formula is used to calculate the difference between the current amount of the portfolio and the amount of portfolio for the last day of the last month (or at the end of last month), where only loans with number of days late over 30 are included.
In the service there, I used a TIMESTAMPDIFF as a compensation formula to calculate the difference in days between the date of the report and the end of last month. Now no matter what date the user chooses it will give the correct difference in days.
Really easy, but it took me a little time to get there.
Hope this helps someone
-
Cannot restore to a restore point from the previous month.
original title: my system restore won't let me restore to the previous month, the radio button works, but the habit of restoration
my windows XP THAT behaves strangely and I tried to use the system restore which has worked well in the past, but now he's depressed the option button but nothing happens
Roy
Hello
1. are you able to restore the computer to other points of restoration?
2. you receive an error message when you try to perform the system restore?
If you are not able to restore the computer to any pint of previous restoration then you can check the steps in the link below to fix the problem.
Steps of troubleshooting for problems when you try to use the System Restore tool in Windows XP
-
List date values in the current month and previous month next month
Hello. I am looking for a way to query a list of each value date in the current month, previous month and next month.
1 DECEMBER 15
...
...
31 DECEMBER 15
1ST JANUARY 16
...
...
30 JANUARY 16
1 FEBRUARY 16
...
...
28 FEBRUARY 16
Any help would be greatly popular!
with the data (start_date and end_date) as)
Select Add_months (trunc (sysdate, 'month'),-1),
Add_months (trunc (sysdate, 'month'), 2)
of the double
)
Select the level - 1 the_date + start_date
from the data
connect by level<= end_date="" -="">=>
-
How to get sales last day of the previous month
HELO guys
I have a question how do I get sales date last day of the previous month where my fact table is level. in fact I tried using Ago but it seems not working. for example, if I chose December 29, 2014 so if I used the function there are then the result will display data on November 29, 2014 (not the last day of November 2014).
Please guys if you have any solution and I really advise thanks to you.
Not exactly under what circumstances specific as you try to reach this goal, but suppose you have a few guest dashboard where you select a day and you have a report with a measure where you want to show the sales of the last day of the previous month based on the selected date in the dash prompt.
If you change the formula of this measure to something like:
FILTER (with the HELP of 'Sales' (DATE = TIMESTAMPADD (SQL_TSI_DAY-1, TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH(@{PV_DATE_SELECTED}) * (-1) + 1, @{PV_DATE_SELECTED}))))
-
Download of the previous months
I signed up for Stock a few months ago. Unfortunately, I had a few personal problems because of which I had to take a break. I came back to the content of the license and realized that my previous allowances do not. I was under the impression that 10 permit licenses for June and July meant that, in the month of August, I would have 30 license. However, I don't see 10.
Is it possible to download the licenses of the previous month I have not used?
As long as your subscription has been paid, you should have these credits. Otherwise, open a session completely exhausted, close your browser, clear the cache of your browser and try again.
-
How to get the last business day of the previous month?
Hi all
We need the user as below,
If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks
Note:
use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?
TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))
Thank you
Deva
Try this,
case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end
As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.
Thank you
AJ
-
How to get a bill from the previous month in the history of the order?
Hi all
I need to have the Bill for the creative cloud may 2015, I can't find this Bill more. In the history of orders, I only see last month's Bill, June 2015. Does anyone know how to get invoices for previous months in the creative cloud Portal?
Thank you much in advance.
Fajar
Fajar all invoices are available in your Adobe account.
But in the case where you are unable to find, please contact customer service.
-
You want to display the current month and previous month data in a single record on forms?
Hello experts,
I have this requirement:
Table structure:
Division of months value totalAmount
01-apr-2013 1 10000
May 1, 2013 1 20000
01-apr-2013 2 30000
May 1, 2013 2 50000
I want to display in forms such as
Form:
Month: May 1, 2013
Total difference of month Division total division prev_Month
May 1, 2013 1 10000 April 1, 2013 1 20000 10000
May 1, 2013 2 30000 April 1, 2013 2 50000 20000
I use two procedure to fetch the records for the current month and the previous month.
but it will cause a problem, if for some data division previous month do not arise.
Please suggest me some query I can get with current and data month pre to unique record.
Please help me.
Thank you
Yoann
I DON'T KNOW BUT TRY...
Select the month of x.mn, x.division, total x.totalAmount, y.mn prev_month, y.division, total y.totalAmount, (y.totalAmount - y.totalAmount) difference
Of
(select month mn, division, totalAmount value)
from table_name
where month = (select max (month)
from table_name
)
) x,.
(select month mn, division, totalAmount value)
from table_name
where month = (select add_months (max (month),-1))
from table_name
)
) y
where x.division = y.division
/
ALEXANDER SIMONNET
DHAKA BANGLADESH
-
Compare the amount of the previous month based on the account number
Hi team,
In my table of the source, amount aggregated by month for a given account there
Now, I need to add a column more in this area, with logic below. There will be more than 1000 accounts available. For each account I need to achieve this.ACCOUNT_NUMBER YEAR MONTH AMOUNT --------------- ------- ------ ----------- 123456789 2012 01 450.00 123456789 2012 02 -234.00 123456789 2012 03 0.00 123456789 2012 04 890.00 123456789 2012 05 78.00 123456789 2012 06 44444.00 123456789 2012 07 450.00 123456789 2012 08 450.00 123456789 2012 09 450.00 123456789 2012 10 120.67 123456789 2012 11 176.88 123456789 2012 12 450.00 123456789 2013 01 340.00
CASE WHEN MONTH_AMOUNT = 0 THE CASE OTHERWISE 1-0 WHEN PREVIOUS_MONTH_AMOUNT = 0 THEN 0 1 OTHER)
On this basis, the objective should be
can someone help me how to compare the value of the previous month. All columns have the data varchar, except for the quantity type.ACCOUNT_NUMBER YEAR MONTH AMOUNT FLAG --------------- ------- ------ ----------- ------------- 123456789 2012 01 450.00 1 123456789 2012 02 -234.00 1 123456789 2012 03 0.00 -1 123456789 2012 04 890.00 1 123456789 2012 05 78.00 1 123456789 2012 06 44444.00 1 123456789 2012 07 450.00 1 123456789 2012 08 450.00 1 123456789 2012 09 450.00 1 123456789 2012 10 0.00 1 123456789 2012 11 0.00 0 123456789 2012 12 450.00 1 123456789 2013 01 340.00 1
Hello
I have not tried. But this desire.
SELECT ACCOUNT_NUMBER, YEAR, MONTH, AMOUNT, CASE WHEN AMOUNT = 0 THE 0 ELSE 1 - CASE WHEN LAG(AMOUNT, 1, 0) OVER (PARTITION BY ACCOUNT_NUMBER ORDER BY YEAR, MONTH) = 0 THEN 0 ELSE 1) AS FLAG FROM SOURCE_TABLE;
See you soon
DidierPublished by: Didier vishwakarma on 6 March 2013 12:36
-
retrieve December as the previous month in 2013
All,
I used this code to retrieve the previous and upcoming months last year that worked very well...
If the date was for example September 7, then a list of the previous months must be shown, and a list of the next months including the current month.
select to_char(to_date(level,'mm'),'FMMonth') month from dual connect by level < to_number(to_char(sysdate,'mm')) MONTH --------- January February March April May June July August
Now we are in January 2013.select to_char(add_months(sysdate,level - 1),'FMMonth') month from dual connect by to_number(to_char(add_months(sysdate,level - 1),'mm')) != 1 MONTH --------- September October November December
When I run the code for the previous months, there is no line. It is right that there is no previous month again in 2013.
I would like to extend the code to display December 2012 as the previous month at the beginning of the year.
How can I achieve this?
Thank you
DianaHello
Try this:
select to_char(trunc(add_months(sysdate, -level) ,'month'),'FMMonth-yyyy') previous_months from dual connect by level <= case when to_number(to_char(sysdate,'mm')) = 1 then 12 else to_number(to_char(sysdate,'mm'))-1 end order by add_months(sysdate, - level)
If wew replace sysdate with date ' 2013-01-08' then it results in:
select to_char(trunc(add_months(date '2013-01-08', -level) ,'month'),'FMMonth-yyyy') previous_months from dual connect by level <= case when to_number(to_char(date '2013-01-08','mm')) = 1 then 12 else to_number(to_char(date '2013-01-08','mm'))-1 end order by add_months(date '2013-01-08', - level) ; PREVIOUS_MONTHS --------------- January-2012 February-2012 March-2012 April-2012 May-2012 June-2012 July-2012 August-2012 September-2012 October-2012 November-2012 December-2012 12 rows selected
If we replace sysdate with date ' 2013 - 02 - 08, then we get:
select to_char(trunc(add_months(date '2013-02-08', -level) ,'month'),'FMMonth-yyyy') previous_months from dual connect by level <= case when to_number(to_char(date '2013-02-08','mm')) = 1 then 12 else to_number(to_char(date '2013-02-08','mm'))-1 end order by add_months(date '2013-02-08', - level) ; PREVIOUS_MONTHS --------------- January-2013
Same thing for 2013 - 05-08 "
select to_char(trunc(add_months(date '2013-05-08', -level) ,'month'),'FMMonth-yyyy') previous_months from dual connect by level <= case when to_number(to_char(date '2013-05-08','mm')) = 1 then 12 else to_number(to_char(date '2013-05-08','mm'))-1 end order by add_months(date '2013-05-08', - level) ; PREVIOUS_MONTHS --------------- January-2013 February-2013 March-2013 April-2013
Kind regards
Peter
-
DAY MONTH FOR THE previous month
Hello
I invited where I have dates like below
31/03/2012
30/04/2012
When I clcik 30/04/2012, I need previous months the other day, then the result should be 31
When I give it as this TIMESTAMPADD (SQL_TSI_DAY,-30, DATE ' @{pvdate} "")... I get previous full day 31/03/2012
When I give it as this DAYOFMONTH (DATE ' @{pvdate} "")... I get months current 30 day
How to get the previous month of day?If you use guests then SQL result or in the SQL report to filter or fx on column
-
recovery of the previous months and the months to come
Hello
I need a list of the last months of the current year as well as a list of the coming months + during the current year.
Example:
Today is September 5, 2012.
Then I nead a list of previous months:
January
February
March
April
May
June
July
August
And al ist of the coming months, including the current month:
September
October
November
December
How can I achieve this.
I know it takes with connect by, but have little experience and knowledge of this.
I'll have to acquire some knowledge on this subject.
Thank you
DianaSQL> select to_char(to_date(level,'mm'),'FMMonth') month 2 from dual 3 connect by level < to_number(to_char(sysdate,'mm')) 4 / MONTH --------- January February March April May June July August 8 rows selected. SQL> select to_char(add_months(sysdate,level - 1),'FMMonth') month 2 from dual 3 connect by to_number(to_char(add_months(sysdate,level - 1),'mm')) != 1 4 / MONTH --------- September October November December SQL>
SY.
-
Records for the parameter and previous months
Hello
I asked where the parameter user is calendar year month (YYYYMM). I need to display the records of the previous month and month.
For ex: If the user enters 201107, I need to display the records of 201107 and 201106.
In addition, I do not use dashboards.
Any suggestion...
Thank youThe only way I can see this with the restrictions is to make the line of the multiple selection column and have the user select the two months. Other that that, you will need to use the dashboard of the guests.
Maybe you are looking for
-
Photos taken of 20 GB of storage while the library is located on another volume
Hello community, I installed macOS Sierra (on an empty SSD) two days ago, yesterday I opened pictures and changed the photo library location to another volume on my computer. The volume that I installed the OS on watch 20 GB of photos. in the storage
-
Satellite A200 - 14 d high speed USB warning
Hi, guys :) For a few months, I have this warning message...I looked in a lot of forums, but found answers very very different each time :( Hope you can help me. I usually only 1 USB mouse connected to my laptop (with Windows XP Pro SP3).The mouse is
-
Under startup programs, it shows Sony's MSS, he has Mcafee logo? I'm not running Mcafee launches I had internet security suite.
-
Display the property Node error 1077
I created a vi with several analog inputs (up to 20), and I want to be able to turn on and off on the front panel plots. I currently have this case structure configured to go through each entry (i n), and the front (LED buttons) can be activated and
-
Cannot install Windows updates (error 0x800706BE)
original title: when I install updates it produces the message: some updates could not be installed: update for windows xp (KB2570791). How is it? What should I do now? Then jeutiliser windows XP Home Edition and was now aboe to have the software a