YTD and Previous YTD in MDX query

Hi All,
I have two parameters Start Date and End Date. when i select the values of start date  as 5th jan 2014 and End Date as 13 th Jan 2014, i want to see the Count of Tickets from 5th Jan 2014 till 13th Jan 2014 as YTD Count of Tickets and Count
of Tickets from 5th Jan 2013 till 13th Jan 2013 as PYTD Count of Tickets. The date range is user specific and is dynamic. I have used cube to create SSRS reports.
Could anyone please tell me how i can pass the selected dates to the query and get YTD and PYTD values?
Thanks
Syed Faiz
SFH

Hello!!
if you have user hierarchy in  date dimension that looks like : year-month-date than you could use following mdx query:
with member measures.[count of tickets last year] as aggregate({parallelperiod([date].[Y-M-D].[year],1,[Date].[Y-M-D].[Date].&[20140104]):
parallelperiod([Date].[Y-M-D].[year],1,[Date Submit].[Y-M-D].[Date].&[20140107])},measures.[count of tickets])
select {measures.[count of tickets],measures.[count of tickets last year]} on 0,[your dimensions] on 1
from yourcube
where
{[Date].[Y-M-D].[Date].&[20140104]:[Date].[Y-M-D].[Date].&[20140107]}
y-m-d is the name of the hierarchy. This query returns results for dates between 01/04/2014 and 01/07/2014.
In order for the query to work you must map date parameters to ssas date dimension members. You should use strtomember function. 
These are usefull links:
http://jsimonbi.wordpress.com/2011/03/22/using-a-date-parameter-in-ssrs-with-mdx/
http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/MSSQLServer/using-a-calendar-for-a-date-hierarchy-pa-2010/
HTH
Ivan Roguljić

Similar Messages

  • P & L report for current period,YTD and previous YTD

    I am trying to create a P & L report with the columns for current period,YTD and previous YTD,  I have include the measures as the key of columns, which by using period or YTD we can retrieve the current period and YTD column, is there as easy way to get the previous YTD? although I can get it  by using evtim to het every month and calculate the previous YTD.

    resolved, just need to bring both time and measures in the columns

  • YTD and and previous year to date as variables

    HI All,
    If your cube doesn't have YTD and and previous year to date as variables to use - can these be created?
    Regards J

    Hi,
    Yes it can be staged in cube but you need to write routine and transformation/update rule level.
    If you need for some query requirement then you may achieve the same at query level. For this you need to create some Restricted Key figures by restricting your key figure with Calyear/month as per your need.
    Query level approcah will be much easier then the cube level.
    I hope it will help.
    Thanks,
    S

  • YTD and Delivered Variables

    Can anyone give their experience and advice on the below questions.
    We need to see data, ie sales, regarding YTD.  We want to publish these reports via Information Broadcasting.  So we have to utilize exit variables that can calculate the range without user intervention.
    For example, if we are dealing with Fiscal Year/Period there is 0FYTCFP (Cumulated up to current fiscal year/period).  This variable denotes an interval from period 1 of the current fiscal year to the current fiscal year period.
    If we use this variable, essentially all we have to do is activate this variable and include it in the query definition (filter)?  Can someone verify this for me?
    Another example is if we are dealing with Calendar Month then there is 0CYTCM (Cumulated up to current month).  This variable denotes an interval from month 1 of the current calendar year to the current calendar month.
    In this case, would you do the same as mentioned above for activating and placing in query definition?
    Thank you

    Hi Mark,
    You are correct. Once the variables have been activated, you can drag the relevant char into the query definition (filter, free chars or rows - as per reqt) and restrict them with the variable.
    Hope this helps...

  • Prior Year YTD and MTD Sales Figure

    Hi,
    I am working on a report where I need to YTD  and MTD figure for current and previous year:-
    I have followed following steps for current year MTD and YTD figures:-
    Create 3 Date variables for Sales on Date with manual input, MTD and YTD on Date characetristics with Customer Exit input. After that I created 3 RKF where I restricted Sales value by each of these date variables.
    Now my question is, Do I need to create two more variables for Prior year MTD and YTD figures with customer exit and then create two more RKF's wherein I will restrict Sales figure with respective variable.
    Is that correct?
    Regards

    Hi,
    you can eighter use the -365 preset  but i suggest creating  2 seerate variables to avoid problems.
    regards
    Ashwin

  • Bw publish and connections not based on the sap bw mdx query driver

    Dear experts,
    we are currently facing a problem with transporting reports that are based on multiple database connections and joined using the cross database join feature of crystal reports. One connection is based on the SAP BW MDX driver, the other is based on a SAP functionmodule.
    Now when transporting the reports with STMS and publishing them via /crystal/rptadmin and bwpublish only the bex mdx query connection gets updated. The other connection is still pointing to the original location.
    e.g.
    transporting
    DEV -> PROD
    function module still pointing on dev server.
    As we need to use the sap default transport system in order to get all features (no SP4 yet) and we can not change the reports manually in the PROD system before publishnig and don't want to mix in the LCM we have no idea how get a work around for this problem.
    Changing the database connection via CMC on the PROD system has no effect either.
    Please help.
    Thank you very much!
    Thorsten

    Hello Thorsten,
    What you observe is "By Design" of the product. The dynamic update is supported only for reports using the BW MDX driver (or historically for those using the deprecated BW query driver). Other SAP drivers such as the OpenSQL driver which you use to connect to the function module do not leverage the same features when using the SAP Transport process.
    You may report directly against your target system when connecting to Function Modules.
    thanks,
    Akin

  • Need MDX query to find something like date diff and Date Range for last 10 days

    Hi ,
    I need two Query .First Query for below;
    I have below data in table like.
    Cat      StartDate    EndDate     
    A    2000-01-01     2000-01-15   
    B    2000-01-02     2000-01-30    
    C    2000-01-01     2000-01-31    
    D    2000-02-01     2000-02-28    
    A    2000-01-10     2000-01-31    
    I need if Startdate and Date completes whole one month then set status =1 else  0 using MDX query.
    like this ;
    Cat      StartDate    EndDate       Status
    A    2000-01-01     2000-01-15    1
    B    2000-01-02     2000-01-30    0
    C    2000-01-01     2000-01-31    1
    D    2000-02-01     2000-02-28    1
    A    2000-01-10     2000-01-31    1
    In second query I need last 10 days from current days like;
    Now = 8/20/2014
    output will be ;
    8/20/2014
    8/19/2014
    8/18/2014
    8/17/2014
    8/16/2014
    8/15/2014
    8/14/2014
    8/13/2014
    8/12/2014
    8/11/2014
    8/10/2014
    Please help me .
    Thanks

    Hi Prajapati,
    In your scenario, you can use Properties and Datediff function to achieve your requirement. Since not know the structure of your cube, we cannot give you the esact query.
     I have tested it on the AdventureWorks cube, the query below is for you reference.
    WITH MEMBER [Measures].[StartDate]
    AS
    [Employee].[Employee Department].CURRENTMEMBER.PROPERTIES('Start Date')
    MEMBER [Measures].[WorkYear]
    AS
    DATEDIFF('yyyy',[Measures].[StartDate],NOW())
    MEMBER [Measures].[Status]
    AS
    IIF(DATEDIFF('yyyy',[Measures].[StartDate],NOW())>10,1,0)
    SELECT {[Measures].[StartDate],[Measures].[WorkYear],[Measures].[Status]} ON 0,
    [Employee].[Employee Department].[Employee].MEMBERS ON 1
    FROM [Adventure Works]
    Results
    Reference
    http://msdn.microsoft.com/en-us/library/ms144821.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • SSRS report with tabular model – MDX query how to get the sum and count of measure and dimension respectively.

    Hello everyone,
    I am using the following MDX query on one of my SSRS report.
    SELECT NON EMPTY { [Measures].[Days Outstanding], [Measures].[Amt] } ON COLUMNS,
    NON EMPTY { ([Customer].[Customer].[Customer Key].ALLMEMBERS) }
    HAVING [Measures].[ Days Outstanding] > 60
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
    FROM ( SELECT ( STRTOSET(@Location, CONSTRAINED)) ON COLUMNS
    FROM ( SELECT ( {[Date].[Fiscal Period].&[2014-06]}) ON COLUMNS
    FROM [Model]))
    Over here, the data is being filtered always for current month and for a location that is being selected by user from a report selection parameter.
    I would like to get the count of total no. of customers and sum of the amount measure.
    When I am using them in calculated members it gives incorrect values. It considers all records (ignores the sub-select statements) instead of only the records of current month and selected location.
    I also tried with EXISTING keyword in calculated members but there is not difference in output. Finally, I manage the same at SSRS level.
    Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
    Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
    Any help would be much appreciated.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
    Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
    Hi Ankit,
    We can use SUM function and COUNT function to sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension. Here is a sample query for you reference.
    WITH MEMBER [measures].[SumValue] AS
    SUM([Customer].[Customer].ALLMEMBERS,[Measures].[Internet Sales Amount])
    MEMBER [measures].[CountValue] AS
    COUNT([Customer].[Customer].ALLMEMBERS)
    MEMBER [Measures].[DimensionName] AS [Customer].NAME
    SELECT {[Measures].[DimensionName],[measures].[SumValue],[measures].[CountValue]} ON 0
    FROM [Adventure Works]
    Besides, you ask that does it make any difference if I manage it as SSRS level and not at MDX query level. I don't thinks it will make much difference. The total time to generate a reporting server report (RDL) can be divided into 3 elements:Time to retrieve
    the data (TimeDataRetrieval);Time to process the report (TimeProcessing);Time to render the report (TimeRendering). If you manage it on MDX query level, then the TimeDataRetrieval might a little longer. If you manage it on report level, then the TimeProcessing
    or TimeRendering time might a little longer. You can test it on you report with following query: 
    SELECT Itempath, TimeStart,TimeDataRetrieval + TimeProcessing + TimeRendering as [total time],
    TimeDataRetrieval, TimeProcessing, TimeRendering, ByteCount, [RowCount],Source
    FROM ExecutionLog3
    WHERE itempath like '%reportname'
    Regards,
    Charlie Liao
    TechNet Community Support

  • YTD and MTD

    HI experts,
    I have to design a open hub and the requirement sheet only gives couple of field, which i can relate with DSO on which I am building my Open Hub but for amount, it says amount in two fields as:
    MTD amount,
    and YTD amount.
    But in DSO the field it will be get mapped is Amount in Document currency.
    Please help how to achive these two field.

    Hi Rajiv,
    YTD and MTD means: Year to Date and Month to Date.
    You need to write some user exits to get the YTD and MTD for the amount.
    With Regards,
    Ravi Kanth

  • Can one Crystal Report could contian Current Month, YTD and ITD data?

    Hi,
    I am trying to build a crystal report and be able to show data in summarized format on single report containing data for the current month, year to date and Inception to date.
    The difficulty that I find is the date ranges. Current month date range is different from YTD and ITD date.
    what would be the best way to show such data on crystal report? is there a sample report available that can help me to produce such report?
    your help will be highly appreciated, thanks!
    regards,
    Mansoor

    Hey Joe,
    if you have CRXI, take a look at the sample reports
    Record Selection on Date Range has some good examples
    you can do this with multiple Groups
    create a formula
    in to currentdate
    ( this group will cover your inception date to currentdate)
    second group will be a date group also, select year as your print by option for this group.
    3rd group also by date,
    select month.
    add fields to your details section, select the field, right click and select summary location,
    (add to all groups)
    you can then supress footers and headers as needed.
    Hope this helps.

  • Step to calculate YTD and MTD in OBIEE

    Hi Experts
    I need to calculate YTD and MTD in OBIEE reports. Please tell me the steps how can i calculate .
    Thanks in advance
    Regards
    Frnds

    Hi..
    Sorry to say this, i am unable to write steps,
    but go through these links.. hope you can understand, if any problem occurs then post here.. we will check
    http://www.rittmanmead.com/2007/04/30/obi-ee-time-dimensions-and-time-series-calculations/
    http://oraclebizint.wordpress.com/2007/11/15/oracle-bi-ee-101332-understanding-todate-and-ago-achieving-mago-qago-and-yago/
    http://oraclebizint.wordpress.com/2007/11/05/oracle-bi-ee-101332-understanding-todate-and-ago-achieving-ytd-qtd-and-mtd/
    If you have any problem after doing these (i mean if any errors), then follow these...
    http://siebel.ittoolbox.com/groups/technical-functional/siebel-analytics-l/time-series-functions-in-obiee-please-asap-1654886
    http://siebel.ittoolbox.com/groups/technical-functional/siebel-analytics-l/help-with-todate-and-ago-time-series-functions-in-obiee-2347570
    Thanks & Regards
    Kishore Guggilla

  • YTD and monthly value in reports

    Hello experts,
    some of our reports show value in terms of YTD value...and the corresponding characteristics are Accounts....
    My user wanted to know if possible to see some accounts showing YTD value and some accounts Monthly value....
    Is it possible?Both Monthly value and YTD value are available in cube....
    Thanks.
    Regards,
    S H

    hi,
    u can also include both monthly value column as well as YTD in report.just that u need to have filter for those account .
    a way is that u can include fiscal year period var in selection screen then make restriction on this basis.
    and for YTD will show value from start of year till date
    ex- if u enter march 2010 to aug 2010.then YTD will show jan 2010 to aug 2010 data.
    So try this
    thanks
    nilesh

  • DTS  Generation number to be assigned to  YTD and QTD

    Hello,
    I have a Periods dimension defined in one of your planning Apps as below . The question I have what is the generation number I have to associate for the YTD and QTD DTS members . In the documentation it says to assign 1 for Y-T-D and 2 for Q-T-D . This does not seem yeild correct results for Q-T-D .
    Vinod
    Periods (YTD,QTD)
    BegBalance (Generation 2)
    YearTotal (generation 2)
    |___ Q1 (generation 3)
    |_Jan (Generation 4)
    |_Feb (gen 4)
    |_mar (gen 4)
    |____Q2 (generation 3)
    |____Q3
    |____Q4
    Thanks
    V

    I got the solution for this........
    Edited by: Kumar on Dec 30, 2010 3:02 PM
    Edited by: Kumar on Dec 30, 2010 3:02 PM

  • Exporting YTD and PERIODIC data

    Hi all,
    I've adjusted a data manager package so that the YTD and PERIODIC measures are automatically selected for export to a flat file. Whenever I want to save the package the script automatically changes and removes either YTD or PERIODIC.
    Any idea how I can change the script so that both YTD and PERIODIC measures are exported to a flat file?
    Thank you.
    DEBUG(ON)
    'PROMPT(SELECTINPUT,,,,"%DIMS%")
    PROMPT(SELECTINPUT,,,,"ENTITY,TIME,C_CATEGORY")
    'PROMPT(MEASURELIST,%MEASURES%,"Please select measures")
    'PROMPT(TRANSFORMATION,%TRANSFORMATION%,"Transformation file:",,,Import.xls)
    PROMPT(TEXT,%FILE%,"Please enter an output application file",)
    'PROMPT(RADIOBUTTON,%ADDITIONINFO%,"Add other information(Appset,Application,User,Time)?",1,{"Yes","No"},{"1","0"})
    'PROMPT(TEXT,%TYPE%,"Please enter the Process Chain Type",)
    INFO(%DIMVALUE%,E=24)
    INFO(%TEMPNO1%,%INCREASENO%)
    INFO(%TEMPNO2%,%INCREASENO%)
    INFO(%MEASURES%,YTD,PERIODIC)
    TASK(/CPMB/APPL_TD_SOURCE,DIMENSIONVALUE,%DIMVALUE%)
    TASK(/CPMB/APPL_TD_SOURCE,MEASURES,%MEASURES%)
    TASK(/CPMB/APPL_TD_SOURCE,OUTPUTNO,%TEMPNO1%)
    TASK(/CPMB/APPL_TD_SOURCE,SELECTION,"%SELECTION%DIMENSION:C_ACCT||DIMENSION:C_DATASRC|INPUT,INPUT_DIFF_ECCS,INPUT_ADJ,INPUT_GW,MJ_MANJE|DIMENSION:FLOW|F_999|DIMENSION:GROUPS|N_GROUP|DIMENSION:INTCO|I_TOTAL|DIMENSION:RPTCURRENCY|LC|")
    TASK(/CPMB/EXPORT_TD_CONVERT,INPUTNO,%TEMPNO1%)
    TASK(/CPMB/EXPORT_TD_CONVERT,TRANSFORMATIONFILEPATH,\ROOT\WEBFOLDERS\Company\LEGAL\DATAMANAGER\TRANSFORMATIONFILES\SYSTEM FILES\Export.xls)
    TASK(/CPMB/EXPORT_TD_CONVERT,SUSER,%USER%)
    TASK(/CPMB/EXPORT_TD_CONVERT,SAPPSET,%APPSET%)
    TASK(/CPMB/EXPORT_TD_CONVERT,SAPP,%APP%)
    TASK(/CPMB/EXPORT_TD_CONVERT,OUTPUTNO,%TEMPNO2%)
    TASK(/CPMB/TD_APPL_SERVER_TARGET,INPUTNO,%TEMPNO2%)
    TASK(/CPMB/TD_APPL_SERVER_TARGET,FULLFILENAME,/interface/BIP/BPC_export/%FILE%)
    TASK(/CPMB/TD_APPL_SERVER_TARGET,ADDITIONALINFO,1)

    Sgt. Rock wrote:
    Should I just break down and buy server space to exchange complete files?
    This the way I do with my co-work production or when work in a team with guys who live out of my country. You can pack/archive the whole project folder into Zip or (Rar - I do that using my PC) which reduces the project folder content globally.
    There are quite many "free hosts" in our days so you can manage your work via Email or Skype and use such servers if you can not afford to buy any hosting space. To my opinion it is best to provide the original project when you use same apps, plugins etc. Any tricky export, audio file compression etc will be time consuming for your partner...
    !http://img59.imageshack.us/img59/4967/aglogo45.gif!

  • BW QUERY and BW MDX Query

    Hi,
    While creating a report through crystal i see one option while creating a connection to database.
    SAP BW Query
    SAP BW MDx Query.
    Could anyone told me whats the technical diffrence between two.
    When option should be used when.
    Thanks
    Ashwani

    The BW Query Driver is an old version. the BW MDX is an enhanced version.
    The BW MDX Driver is able to leverage a BW query with two structures and it shows display attributes.
    ingo

Maybe you are looking for

  • How I tried fix my partitions and restore a Dell Diagnostic Partition.

    UPDATED: 2 September 2012 UPDATE: Now that I reflect back on the incidence, I realize that the Dell Utility partition had lost its ability to boot long before I had messed up my partition table. But I realized it only when I was testing all my partit

  • Safari (and FF) crashes constanly when visiting specific web sites

    Hi guys, as of couple of hours ago I'm having huge problems with almost any sort of web browsing I am trying to do. But let's start this story at the start... Few days ago I finally got a chance to get to my external hard drive and make a backup of m

  • Paper jam issue on HP OfficeJet Pro X576DW

    My recently bought HP OfficeJet Pro X576DW displays and initiates a Paper Jam warning and holds printing subsequently. However, there is no "paper jammed". Seems like one of the sensors is confused. Is there a way to hard reset the printer, cause it

  • Text files into Object ArrayList

    I have another class reading line-for-line text file, send each line to a class object and that class splits the line into fields. An ArrayList holds the objects. No problem. Then, an almost similar setup. This time, the file is clusters. A blank lin

  • ICal Shared Not Appearing on iOS Devices But Do In Macs' iCals

    I am running Mountain Lion, but this issue was also happening in Lion. As a former Apple Specialist who specialized in iCloud, I've stumped myself and several AppleCare reps. They have forwarded this on to the engineers.  I have three calendars that