cancel
Showing results for 
Search instead for 
Did you mean: 

how to restrict data

former_member196948
Participant
0 Kudos

Hi All,

I have an query,

i have data like below

Quarter                Amount

1Q 20081098046
2Q 20081086064
3Q 20081070520
4Q 20081035790
1Q 20091020156
2Q 20091018464
3Q 20091017317
4Q 20091013442
1Q 20101007551
2Q 2010998727
3Q 2010989713
4Q 2010983499
1Q 2011979105
2Q 2011980793
3Q 2011986718
4Q 2011993552
1Q 20121001101
2Q 20121005139
3Q 20121001720
4Q 2012989727
1Q 2013985878
2Q 20131138789
3Q 20131144091
4Q 20131144487
1Q 20141140507

and i want output with below query

Output : two year period of  data

if report run on Jan 2014

it should reflect Jan 2012-Dec. 2013 data

1Q 20121001101
2Q 20121005139
3Q 20121001720
4Q 2012989727
1Q 2013985878
2Q 20131138789
3Q 20131144091
4Q 20131144487



for next run

if report run on Apr 2014

it should reflect April  2012 – March 2014 data

2Q 20121005139
3Q 20121001720
4Q 2012989727
1Q 2013985878
2Q 20131138789
3Q 20131144091
4Q 20131144487
1Q 20141140507


and so on....


how can i achieve this


please advice


Thanks in advance

Ranjeet  

Accepted Solutions (1)

Accepted Solutions (1)

saurabh_sonawane
Active Contributor
0 Kudos

Hi RANJEET,

can u try this

create this dimension

month=ToDate([Cal. year / month];"MM.yyyy")

month -1=RelativeDate([month];-26)

final month -365=RelativeDate([month];-365)

create a measure

amountfinal = amount where [Cal. year / month] >= final month -365 and [Cal. year / month] <=month -1

former_member196948
Participant
0 Kudos

Hi All,

I found the solution of my query.

I have to create some variable for finding the output

Variables:

variable Name                    syntax                                                       result

1)V_Todate :                =ToDate([month];"yyyyMM")                              for converting into date format

2)V_Currentdate           =CurrentDate()                                                  current date

3)V_Relativedate          =RelativeDate([V_Currentdate];-1)                       previous date

4) V_monthbetween     =MonthsBetween([V_todate];[V_Relativedate])     no of month between two                                                                                                          dates

then i applied filter on V_monthbetween with (Less than or equal to 24) for restricting the the data for 2 years

Thanks to all who replied or viewed my query

Ranjeet

saurabh_sonawane
Active Contributor
0 Kudos

great bro

my solution help u or not????

former_member196948
Participant
0 Kudos

Hi Saurabh,

your idea didn't work, but while working with your solution. i got this idea that i can with Current date function and achieve that.

So thanks again

Ranjeet

saurabh_sonawane
Active Contributor
0 Kudos

ok  

Answers (2)

Answers (2)

Former Member
0 Kudos

Ranjeet,

Create an object at universe level with the following syntax.

End_Quarter = Substr([Quarter];1;2) +" " +  (ToNumber(Substr([Quarter];4;4))+2) // Quarter after 2 Years from selected quarter.


Now in WEB I, create a prompt on Quarter...

This will give you 2years data based on selected quarter.

former_member196948
Participant
0 Kudos

Hi Sujitha

Thanks for the reply ,

but there is a change in query business has changes the data from quarter to month and the format of data also

the new format is given below

Month   amount

201101327309
201102326420
201103325376
201104326139
201105326831
201106327823
201107328566
201108328613
201109329539
201110330022
201111331741
201112331789
201201332785
201202334111
201203334205
201204334990
201205335531
201206334618
201207334823
201208333777
201209333120
201210331533
201211329858
201212328336
201301327673
201302329045
201303329160
201304379225
201305379700
201306379864
201307379926
201308382183
201309381982
201310381419
201311383919
201312379149
201401381057
201402379749
201403379701

and i want output with below query

Output : two year period of  data

if report run on Jan 2014

it should reflect Jan 2012-Dec. 2013 data


201201332785
201202334111
201203334205
201204334990
201205335531
201206334618
201207334823
201208333777
201209333120
201210331533
201211329858
201212328336
201301327673
201302329045
201303329160
201304379225
201305379700
201306379864
201307379926
201308382183
201309381982
201310381419
201311383919
201312379149



for next run

if report run on Apr 2014

it should reflect April  2012 – March 2014 data


201204334990
201205335531
201206334618
201207334823
201208333777
201209333120
201210331533
201211329858
201212328336
201301327673
201302329045
201303329160
201304379225
201305379700
201306379864
201307379926
201308382183
201309381982
201310381419
201311383919
201312379149
201401381057
201402379749
201403379701


please advice how to solve this issue



Thanks in Advance


Ranjeet



saurabh_sonawane
Active Contributor
0 Kudos

change the date  format as

MMMM yyyy


it will display output as


April 2014



if u want Apr 2014 then


MMM yyyy




former_member196948
Participant
0 Kudos

Hi Saurabh,

Thanks for reply but my query  is how to restrict the data as below

Output : two year period of  data

if report run on Jan 2014

it should reflect Jan 2012-Dec. 2013 data



for next run

if report run on Apr 2014

it should reflect April  2012 – March 2014 data


for data part please go through my previous post to Sujitha


Thanks in advance


Ranjeet 






saurabh_sonawane
Active Contributor
0 Kudos

he r u get cal day in ur query

former_member196948
Participant
0 Kudos

FORMAT IS LIKE "YYYYMM"  ONLY NO DAY

RANJEET

former_member182346
Active Contributor
0 Kudos

Hi,

Create a user exit variable.

Logic : whatever value entered by user say period 0042014, Program will fill the LOW and HIGH value as

HIGH = <user entered period> - 1 (make 004 -1 = 003) and use same yr. Special care for Yr if period is like 0012014

LOW = <user entered period> - 25 ( keep the period value same i.e. 004, where as reduce the year by 2 i.e.2014-2 = 2012)

OPTION = BT

take help from ABAPer to get logic works for you.

You may need to consider the user entered period like 0012014 to get the range of data with year change.

Thank-You.

Regards,

VB