MDX Prior Quarter Day Range

I've been tasked with a rather odd Time intelligence function by my finance group that I'm trying to puzzle out.
I've been asked with creating a measure within our SSAS Cube to allow for seeing previous quarter to date based on how far we are in the current quarter. But instead of seeing a standard idea of days elapsed currently versus days elapsed previously, they would
like to see days remaining versus previous days remaining.
What I mean by that is, take 1/22/2015 for example. We have 48 days remaining in our current quarter, which I have by means of a calculated measure. I need to find the corresponding working day from the previous quarter where it is also at 48 days remaining.
At that point I could create a date range with some aggregate functions off of the first date in the previous quarter to the corresponding date found in the above and come up with what they are looking for.
The best idea I've had so far is to possibly do this in the database section itself, by creating a new column that is essentially the calculated number of days remaining but stored. But at that point I'm not sure how to take a calculated measure in SSAS and
filter a previous quarter date member to use that property as it were.
Any direction would be much appreciated here.

Hi thebyob, 
Thank you for your question.  
I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.  
Thank you for your understanding and support. 
Best Regards,
Simon Hou
TechNet Community Support

Similar Messages

  • Ageing report-Days range as an I/p

    Based on posting date we designed an Ageing report
    0  30  60  90  120  ....
    now users want day range as an i/p
    means => user will i/p day range say 40 then report will be executed for 0  40  80  120 .....
    if i/p for day range is 60 then 0  60  120  180 ......
    previously we resticted the key figure by posting date variable by settng the offset range
    like RFK1--- 0balance restricted by var (0-30)
          RKF2--- 0balance restricted by var (31-60) and so on...
    before we were able to hardcore it but with the current requirment we have to take user i/p var and then accordingly ageing report will be generated..
    pl let us know the right way

    okay...
    we have created one char : ZOFFSET (no of days) and included in the target on which ageing report is based on...,,,, after that we crearted a user exit variable Zvar_offset(ready for i/p) on char ZOFFSET.....
    In ZXRSRU01,
    when zpost_dt  {zpost_dt is the user exit variable ,ready for i/p,defined for posting date}
    if i_step = 1
    date_low = zpost_dt.
    date_high = zpost_dt - Zvar_offset. {not sure whether this logic will work or not!!!}
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW  = date_low.
    L_S_RANGE-high  = date_high.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT  = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    even after this we cant achieve the motive, as zpost_dt will have range value high and low after user exit execution  but in our query its a single value i/p (user will give only one posting date) ,,,
    also what abt other buckets (other ranges for the same offset) because code will return only one range however we want more ranges for different intervals

  • Displaying current and prior quarter data in FR

    Hi,
    I have two grids in report.Grid 1 and Grid 2.
    I have to display data for current quarter and current year in Grid1
    and Grid 2 should display data for prior quarter and year should change accordingly.
    Ex Grid1 : Q4 2008 Then Grid2: Q3 2008, this works by using relative period.
    But problem is when Grid1: Q1 2008, Grid2 should be: Q4 2007.
    How would this be possible?Can we use any formula or condition?
    Any idea would be appreciated.
    Thanks

    Of course it works, I tested on my environment, independently of what I have as accounts or anything else. If you want Grid2 to show the prior Quarter swap the values like this:
    Grid1 Column A: Current Point of View for Period
    Current Point of View for Year
    Grid2 Column A: Period Current Point of View for Period offset by -1
    Current Point of View for Year
    You dont need to worry about the Year, for it knows to go back based on the other parameters.
    If you select in your POV__________________________Year: 2008________________________Period: Q1
    You will get the following results:
    Grid2: Q4 2007
    Grid1: Q1 2008

  • Queries for current Qtr and prior quarter

    If I select one date in dashboard prompt in one column I want to display current quarter revenue and prior Qtr revenue.
    Could anyone give me the queries for the current Qtr and prior Qtr?
    So I will going to use presentation variable from the dashboard prompts

    obiee-date-expressions-reference
    Date Calculation OBIEE Expression Explanation :
    First Day of the Previous Year
    TIMESTAMPADD( SQL_TSI_YEAR , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD removes a year from the returned date for the First Day of the Previous Year.
    First Day of the Current Year
    TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE) This calculation returns the first day of the year by deducting one less than the total number of days in the year.
    First Day of the Next Year
    TIMESTAMPADD( SQL_TSI_YEAR , 1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD adds a year to the date returned which will give the first day of the next year.
    First Day of the Previous Month
    TIMESTAMPADD(SQL_TSI_MONTH, -1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the Current Month. The second TIMESTAMPADD then subtracts one month from the first day of the Current Month arriving to the First Day of the previous month.
    First Day of the Current Month
    TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE) This expression gets the current day of the month and subtracts one less than the current day to arrive at the first day of the month.
    First Day of the Next Month
    TIMESTAMPADD(SQL_TSI_MONTH, 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the Current Month. The second TIMESTAMPADD then adds one month from the first day of the Current Month arriving to the First Day of the next month.
    First Day of Current Quarter
    TIMESTAMPADD( SQL_TSI_DAY , DAY_OF_QUARTER( CURRENT_DATE) * -(1) + 1, CURRENT_DATE) This was included to show the calculations discussed above can be used with other functions. This is the same expression as the one that returns the first day of the current month except this one uses the DAY_OF_QUARTER property to return the first day of the current quarter.
    Last Day of the Previous Month
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the Current Month. The second TIMESTAMPADD subtracts a month to arrive at the first day of the previous month.
    Last Day of Current Month
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD finds the first day of the current Month. The second TIMESTAMPADD adds one month to the date to arrive at the first day of the next month. The final TIMESTAMPADD subtracts one day from the returned date to arrive at the last day of the Current Month.
    Last Day of the Next Month
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 2, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD finds the first day of the current Month. The second TIMESTAMPADD adds two months to the date to arrive at the first day of month after next. The final TIMESTAMPADD subtracts one day from the returned date to arrive at the last day of the Next Month.
    Last Day of Previous Year
    TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1,
    CURRENT_DATE)) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD subtracts one day to arrive at December 31st of the previous year.
    Last Day of Current Year
    TIMESTAMPADD(SQL_TSI_YEAR, 1, TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD deducts one day to arrive at December 31 of the previous year. The third TIMESTAMPADD adds a single year to the date to arrive at December 31 of the Current Year.
    Last Day of the Next Year
    TIMESTAMPADD(SQL_TSI_YEAR, 2, TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) From right to left the first TIMESTAMPADD returns the first day of the current year. The second TIMESTAMPADD deducts one day to arrive at December 31 of the previous year. The third TIMESTAMPADD adds 2 years to the date to arrive at December 31 of the Next Year.
    Last Day of Current Quarter
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_QUARTER , 1, TIMESTAMPADD( SQL_TSI_DAY , DAY_OF_QUARTER( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))) Demonstrated using Quarters. From right to left the first TIMESTAMPADD returns the first day of the Current Quarter. The second TIMESTAMPADD returns the first day of the next quarter. The final TIMESTAMPADD subtracts a single day from the date to arrive at the last day of the Current Quarter.
    Number of days between First Day of Year and Last Day of Current Month TIMESTAMPDIFF(SQL_TSI_DAY, CAST('2010/01/01 00:00:00' AS DATE), TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)))) For simplicity I hard coded the January 1, 2010 date and CAST it to a date. I could have used the First Day of the Current Year calculation but didn’t want to over clutter the example. The second part of the TIMESTAMPDIFF uses Last Day of the Current Month calculation to force the TIMESTAMPDIFF to calculate the number of days between the first day of the year and the last day of the current month.
    =============
    FYI, let say some example,
    Last day of previous Quarter:
    "GPC_DataMart"."GPC_DataMart"."dbo"."LQ_Position"."Business_Date"=TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAY_OF_QUARTER( "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date") * -(1) + 1, "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date"))
    Last month last day:
    "GPC_DataMart"."GPC_DataMart"."dbo"."LM_Position"."Business_Date"=
    TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date") * -(1) + 1, "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date"))
    Last year Last day
    "GPC_DataMart"."GPC_DataMart"."dbo"."LY_Position"."Business_Date"=
    TIMESTAMPADD( SQL_TSI_DAY , -1, TIMESTAMPADD( SQL_TSI_DAY , EXTRACT( DAY_OF_YEAR FROM "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date") * -(1) + 1, "GPC_DataMart"."GPC_DataMart"."dbo"."MT_BUSINESS_DATE"."Business_Date"))
    Thanks and Regards,
    Deva
    http://obieeelegant.blogspot.com/2011/06/obiee-date-expressions-reference.html

  • MDX Filter with date range

    Hi,
    my requirement is to create a calculated member to calculate Total unique customers who has sales > 0 within the date range.
    Below mdx works normally with single date
    DistinctCount(FILTER([Customer_Sales].[Outlet ID].[Outlet ID].members,
    ([Measures].[distribution],
    [Date].[CalendarWeek].CurrentMember
    )=1))
    I'm looking for something like below with date range,
    DistinctCount(FILTER([Customer_Sales].[Outlet ID].[Outlet ID].members,
    ([Measures].[distribution],
    WTD([Date].[CalendarWeek].CurrentMember
    ))=1))
    Above MDX fails with the error: String of numeric expression expected, Tuple set expression was used.
    Appreciate your immediate response.
    Thanks in advance

    Hi Chandima,
    Thanks for the response.
    I tried your code, it works but the results are not correct.  As per manual calculations, there are 28 unique customers who has positive sales on Week to date (2014-11-03), but result shows only 19.
    For the first day of week (2014-11-01), there are 9 unique customers, which is correct. But for the following days it is not giving correct result.
    Further, performance of this approach is very poor
    Thanks,

  • Change day range in Calendar to end at 3am?

    Hello, I am a night-owl.  It would help when planning my day if the day hour range spanned from something like 11am to 3am, rather than 12am to 11pm.  I don't think this is possible but thought I should ask, anyway.
    Thank you.

    I think you want to know, days & time picked by which machine, locally or from server? It does take from server where the application is running.

  • How to Implement 30 days Range Partitioning with Date column. Not Interval

    Hi,
    I am using the db:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
    Current table structure is:
    CREATE TABLE A
    a NUMBER,
    CreationDate DATE
    PARTITION BY RANGE (CreationDate)
    INTERVAL ( NUMTODSINTERVAL (30, 'DAY') )
    (PARTITION P_FIRST
    VALUES LESS THAN (TIMESTAMP ' 2001-01-01 00:00:00'))
    How can I define virtual column based partitioning with RANGE partitioning without using INTERVAL partitioning.
    And that is with Intervals of 30 days.
    For monthly I am trying as
    CREATE TABLE A
    a NUMBER,
    CreationDate DATE,
    monthly_interval date as (to_char(CreationDate,'MM-YYYY')) VIRTUAL
    PARTITION BY RANGE (monthly_interval)
    partition p_AUG12 values less than (to_date('08-2012','mm-yyyy')),
    partition p_SEP12 values less than (to_date('09-2012','mm-yyyy')),
    partition p_OCT12 values less than (to_date('10-2012','mm-yyyy'))
    Enable ROw Movement
    BUT CAN'T INSERT the data even for that:
    Insert into a (a, CreationDate)
    Values (1, '12-10-2012')
    Insert into a (a, CreationDate)
    Values (1, '12-10-2012')
    Please suggest..

    Hi rp,
    Interval Partitioned to Range. Created Daily Partitions from Monthly Part. got complicated so I am posting here.
    Basically,
    I know Interval Partitioning is a kind of Range partitioning. But explicitly for Interval Partitioned tables XML Indexes are not allowed as discussed here:
    XMLIndexes on an Interval Partitioned Table??
    I can do monthly partitions as :
    CREATE TABLE A
    a NUMBER,
    CreationDate DATE,
    monthly_interval varchar2(8) as (to_char(CreationDate,'MM-YYYY')) VIRTUAL
    PARTITION BY RANGE (monthly_interval)
    partition p_AUG12 values less than ('09-2012'),
    partition p_SEP12 values less than ('10-2012'),
    partition p_OCT12 values less than ('11-2012')
    ) Enable ROw Movement
    Insert into a (a, CreationDate)
    Values (1, '12-SEP-2012')
    Insert into a (a, CreationDate)
    Values (1, '14-SEP-2012')
    Select * from A partition (p_SEP12)
    Select * from A partition (p_AUG12)
    Select * from A partition (p_OCT12)
    Can we do it for 30 days partitions, instead of the monthly partitions. ANY suggestions..
    Thanks..

  • Selecting key of Days Range

    Hi All,
    I am calculating number of days between 2 dates (dt2-dt1)+1
    i have a traget table with ranges specified as
    key     days_from     days_to
    1     1     4
    2     5     10
    3     11     30
    4     31     99999999999999
    like....
    select KEY from days_range where ( (dt2-dt1)+1
    ) between(DAYS_FROM,DAYS_TO)
    how do i get the key after i calculate number of days, i dont want to use case statement, as my range table might grow and i will ahve to revisit the case statement.
    please suggest.
    thanks
    Edited by: user633377 on Jun 30, 2009 7:43 AM

    More rows added
    SQL> with d as (
      2  select  to_date('01-Jan-2009','dd-Mon-yyyy') dt1,
      3     to_date('21-Jan-2009','dd-mon-yyyy') dt2  from dual union all
      4  select  to_date('01-Jan-2009','dd-Mon-yyyy') dt1,
      5     to_date('06-Jan-2009','dd-mon-yyyy') dt2  from dual union all
      6  select  to_date('11-Jan-2009','dd-Mon-yyyy') dt1,
      7     to_date('12-Jan-2009','dd-mon-yyyy') dt2  from dual
      8  ),
      9  keys as (
    10  select 1 key, 1 days_from, 4 days_to from dual union all
    11  select 2, 5, 10  from dual union all
    12  select 3, 11, 30 from dual union all
    13  select 4, 31, 99999999999999 from dual
    14  )
    15  select keys.*, dt2 - dt1 +1  diff
    16  from d , keys
    17* where dt2 - dt1 +1  between days_from and days_to
           KEY  DAYS_FROM    DAYS_TO       DIFF
             3         11         30         21
             2          5         10          6
             1          1          4          2SS

  • Abap type 6 to select by days range

    Hello All,
    I have an infopackage I want to run with a selection on days (from monday to friday, or from wednesday to monday for example).
    As I run the package, it gets zero records and in the monitor I saw selection was "correctly" set to "20060716 - 20060724;" for example.
    If I use a manual (in sense of the selection) infopackage with same selection, I get records.
    In the monitor, the two selections appear exactly the same.
    So I guess a problem of formatting dates when I return days to the infopackage.
    Please note that actual version works on the week (on another field ..) and it is ok.
    Has someone any hint?
    Thanks a lot in advance
    Best Regards
    Alex

    Hi Visu,
    You're correctly getting my points ...
    I "suppose" I'm using the standard calendar, I'm upgrading from a previous routine where I was using 0CALWEEK without any problem. Now I'm using a custom day object.
    1/ I'm using an object reference of 0DATE
    2/ I'm entering nothing (I think ..)
    3/ below the code.
    Thanks a lot
    Regards
    Alessandro
    TABLES: /BIC/AXDVODS1C00, SCAL.
    DATA:   current_week like /BIC/AXDVODS1C00-CALWEEK.
    DATA:   current_week1 like /BIC/AXDVODS1C00-/BIC/XINSDATE.
    DATA:   result_week1 like SCAL-WEEK.
    DATA:   first_day    like SCAL-DATE.
    DATA:   last_day     like SCAL-DATE.
    DATA:   first_day    like /BIC/AXDVODS1C00-/BIC/XINSDATE.
    DATA:   last_day     like /BIC/AXDVODS1C00-/BIC/XINSDATE.
    $$ end of global - insert your declaration only before this line   -
        InfoObject      = XINSDATE
        Fieldname       = /BIC/XINSDATE
        data type       = DATS
        length          = 000008
        convexit        =
    form compute_/BIC/XINSDATE
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
          Insert source code to current selection field
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
    select Max( /BIC/XINSDATE ) into current_week1 from  /BIC/AXDVODS1C00.
    current_week1 = current_week1 + 1.
    call function 'DATE_GET_WEEK'
             EXPORTING
                  date = current_week1
             IMPORTING
                  week = result_week1 "YYYYWW
             EXCEPTIONS
                  date_invalid = 1
                  other = 2.
    call function 'WEEK_GET_FIRST_DAY'
             EXPORTING
                  week = result_week1
             IMPORTING
                  date = first_day "DD.MM.YYYY
              EXCEPTIONS
                  date_invalid = 1
                  other = 2.
    first_day = first_day - 1.
    last_day  = first_day + 6.

  • Need an MDX query for Date range

    Hi there,
    My requirement is to filter sales from 1st of month to until holiday of the month. I am able to use to ":" range function for filtering, but I am not able to filter on holiday date. Becuase both filter and exists are giving set results, I need
    member expression to use range function. Please let me know ASAP.
    Thanks,
    ATRSAMS

    Hi ATRSAMS ,
    You can get the first member of the month with the OpeningPeriod function, and item(#) to have a specific member from a set .
    So if you want first member from your set : filter(.....).ITEM(0)
    Regards, David .

  • Prior function in MDX

    HI,
    I am converting an BSO to ASO so need to change the Member furmula in MDX. I need to to change the following Prior function to MDX:
    @PRIOR( "Measure1" -> "EOPTIME" -> "DCAP001", 12, @LEVMBRS ("DLOS014", 0))
    my doubts are:
    1. How to use cross dimension in Prior function as comma (,) but it will take as an argument in function and even i cann't use braces also.
    2. in MDX we can't use range in lag function. so how to use range in lag function in MDX or any other approach?
    Thanks in advance.
    Regards,
    Abhishek

    to do the prior, you would use the lag function. It looks like you are lagging back 12 periods so you would have to add the periods dimension into the touple.
    To get the members you would use a tuple which would be something like ( [Measure1],[EOPTIME],[DCAP001],[Periods].currentmember.lag(12))
    Put that inside a case statment like Case When ISleaf([DLOS014].currentmember) then

  • CURRENT YEAR SALES DATE PARAMATER AND PRIOR YEAR SAME DATE RANGE

    I am pulling data from a SQL view dbo.view that has current and historical SOP data by line.  The date paramater is a date range,  uppr date and lower date formulas are in the report.  I need to include prior year SOP data for the same prior year date range in the detail.  I have tried adding the view in twice with no luck, just duplications.  Ultimately I want to supress the detail and only show the totals by customer so it is comparitive.  Thanks for your help.  Jayne

    OK
    lets simplify it
    get a test data source with some simple dates in it.
    get the report logic working.
    it looks like you have the right formula ideas but lets go for
    @upperthisyear
    @upperlastyear
    @lowerthisyear
    @lowerlastyear
    then assuming a date field of {table1.date}
    the record selection would be
    if (@upperthisyeare > {table1.date} and @lowerthisyear < {table1.date}) or (@upperlastyeare > {table1.date} and @lowerlastyear < {table1.date}) then 1 else 0
    I would test this by using it as a formula field with the test data.

  • Quarter

    Hi,
    I need to get the last day (working day) of the prior quarter.
    DateA is the date from my facttable, and DateB have values to use (history).
    I use an expression operator to calculate the correct day
    ID_DateB Between (TO_DATE(CONCAT('/01',
    DECODE(WB_CAL_QTR("FT_INSTRUMENTOS"."ID_DateA "),1,'JAN',2,'APR',3,'Jul',4,'Oct'),
    TO_CHAR("FT_INSTRUMENTOS"."ID_DateA ",'YYYY')))) - 8 )
    AND
    (TO_DATE(CONCAT('/01',DECODE(WB_CAL_QTR("FT_INSTRUMENTOS"."ID_DateA "),1,'JAN',2,'APR',3,'Jul',4,'Oct'),
    TO_CHAR("FT_INSTRUMENTOS"."ID_DateA ",'YYYY')))) - 1 )
    But OWB put the full statment directly in my joiner-where, and the "DECODE" don't work there
    I need this operation in a nested select, how can change the query code??? or what operator I must use?? other way to do this??
    ---After set a range of day, I use a aggregator operator and use a MAX command in the having clause to return the last day of the prior quarter.---
    Thanks

    see if this function is of any help to you.
    /* Formatted on 2009/02/11 22:06 (Formatter Plus v4.8.8) */
    CREATE OR REPLACE PROCEDURE previous_records
    AS
       CURSOR c1
       IS
          SELECT h_date
            FROM holiday;
       previous_date         DATE;
       previous_week_date    DATE;
       previous_month_date   DATE;
       previous_year_date    DATE;
    BEGIN
       SELECT SYSDATE - 1
         INTO previous_date
         FROM DUAL;
       SELECT SYSDATE - 7
         INTO previous_week_date
         FROM DUAL;
       SELECT ADD_MONTHS (SYSDATE, -1)
         INTO previous_month_date
         FROM DUAL;
       SELECT ADD_MONTHS (SYSDATE, -12)
         INTO previous_year_date
         FROM DUAL;
       FOR c1rec IN c1
       LOOP
          BEGIN
             IF (TRUNC (previous_date) = TRUNC (c1rec.h_date))
             THEN
                SELECT (previous_date - 1)
                  INTO previous_date
                  FROM DUAL;
             END IF;
             IF (TRUNC (previous_week_date) = TRUNC (c1rec.h_date))
             THEN
                SELECT (previous_week_date - 7)
                  INTO previous_week_date
                  FROM DUAL;
             END IF;
             IF (TRUNC (previous_month_date) = TRUNC (c1rec.h_date))
             THEN
                SELECT ADD_MONTHS (previous_month_date, -1)
                  INTO previous_month_date
                  FROM DUAL;
             END IF;
             IF (TRUNC (previous_year_date) = TRUNC (c1rec.h_date))
             THEN
                SELECT ADD_MONTHS (previous_year_date, - 12)
                  INTO previous_year_date
                  FROM DUAL;
             END IF;
          END;
       END LOOP;
       DBMS_OUTPUT.put_line ('Previous Day is:' || previous_date);
       DBMS_OUTPUT.put_line ('Previous Week Day is:' || previous_week_date);
       DBMS_OUTPUT.put_line ('Previous Month Day is:' || previous_month_date);
       DBMS_OUTPUT.put_line ('Previous Year Day is:' || previous_year_date);
    END previous_records;
    /

  • How can ew add filter in Dataset of MDX Query

    Hi,
    I am working on TFS 2010 Report with Report Builder 3.0
    I need to fetch data on basis of Start Task Date(means when user start their task).
    So i have added a new field in a TFS Work Item Template with name StartTaskDate.
    Now i need to fetch the report FromTaskDate to TOTaskDate(Date Range Filter).
    so how can we do this with filter option?
    Can any body help me on this.
    Thanks

    Hi rohitnegi09,
    If you want @FromTaskDate and @TOTaskDate parameters are Date/Time data types, please refer to my last reply in the following thread:
    http://social.technet.microsoft.com/Forums/en-US/db75abb9-2250-463a-8ef3-70426f617329/mdx-report-on-date-range?forum=sqlreportingservices
    If you want @FromTaskDate and @TOTaskDate parameters are Text data types, we can directly type the following MDX query in the dataset:
    select
    {[Measures].[Internet Sales Amount]
    } on columns,
    {[Date].[Date].members} on rows
    from(
    select
    STRTOMEMBER("[Date].[Date].&["+@FromTaskDate+"]"):STRTOMEMBER("[Date].[Date].&["+@ToTaskDate+"]")
    ) on columns
    from [Adventure Works]
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Need Avg sales for 90 fiscal days - thru customer exit or Offset  ? ? ? ?

    Hi Frns!
    My current report generates daily sales for fiscal period using a customer exit variable A.
    My requirement now is to have one more column having Average sales for 90 prior fiscal days when i enter a fiscal period thru the same variable A.
    As the customer exit variable is of Selection Options, I'm unable to create Offset for the same.
    Guyz do need ur help on this urgently.
    Cheers! Shana

    Any updates !!!!!!!!!!!!!

Maybe you are looking for

  • How to find out by MDX that the current users is member of a role - Default member issue

    Hi, just imagine you have a dimension with a few members (A, B, C...). I defined a role which gives some users only rights to "B". On the other hand the default member for the dimension is set to "A". Now users part of the role get an error that the

  • Can no longer connect my B&W A7

    Hello : Recently bought Airpot Extreme and my A7 will no longer connect via AirPlay.  Do not know what to do B&W tech support wrote me this:                       If you are able to set up your A7 but, it will not work wirelessly network can you plea

  • Downloaded Oracle8i Not Installing on SuSE 7.2

    I tried downloading Oracle's 8i server onto a SuSE 7.2 box with 224MB of memory and 500MB swap space. I tried running runInstaller with the failure: Initializing Java Virtual Machine from ../stage/Components/oracle.swd.jre/1.1.8/1/DataFiles/Expanded/

  • Sonos and Time Capsule

    I have all my music stored on a Time Capsule, and am using Sonos to play it throughout my house. However, dropouts are frequent, and I believe it is the TC and not the Sonos. The dropouts hit all rooms at the same time, leading me to the conclusion t

  • LINK command in a Report Script 9.3.3

    Hello, I would be greatful if someone could help me with one line in a Report Script.  I do not know what I am doing.  We currently have the line below, which has worked well for years. <LINK (<LEV("Account",0) AND NOT <DESCENDANTS("Statistical_Accou