How to restrict prevmember function to calculate for a particular year

Hi,
I have a MDX query that calculates the cumulative sum, using current & previous member. Now when year is January, i want the query to ignore prevmember value. Can somebody please help how this can be achieved?
My query:
CASE WHEN
   [Date].[CALENDAR].PrevMember
     ,[Measures].[TOTAL KM]
    )  + [Measures].[TOTAL KM] )=0 THEN 0 
ELSE
   [Date].[CALENDAR].PrevMember
     ,[Measures].[Number of Events]
    )  + [Measures].[Number of Events]) * 200000/
   [Date].[CALENDAR].PrevMember
     ,[Measures].[TOTAL KM]
    )  + [Measures].[TOTAL KM] ) END

Hi Mayank,
According to your description, you need to calculate the cumulative sum, and reset it on January of each year, right?
In this case, you can use YTD function to achieve your requirement. I have tested it on AdventureWorks, the query below is for you refernece.
WITH MEMBER MEASURES.YTDDEMO AS
AGGREGATE(YTD(), [Measures].[Internet Sales Amount])
SELECT {[Measures].[Internet Sales Amount], MEASURES.YTDDEMO} ON 0,
[Date].[Calendar].[Month].MEMBERS ON 1
FROM
[Adventure Works]
Regards,
Charlie Liao
TechNet Community Support

Similar Messages

  • How to restrict  tcode va01/va02/va03 for a particular role

    hi ,
    I have a requirement . I need to restric user fro VA01/VA02/VA03 if the user has role and Sales order customer group is related to a particular group .
    Do we have a Function module to get a role for a user  or can we write a code as authorization level or do we need to write it as user exits of va01/va02/va03 .
    Regards ,
    Prakash

    hi All ,
    My issue is I need to restrict the tcodes for a particular customer group is there in the sales order , that means it is order specific and I already know for which roles it is to be checked .
    Now can  we write any check in pfcg tcode so that we can check at particular group or need to handle at user exit level .
    Thanks in advance .
    prakash

  • How to restrict the st loc list applicable to particular plant mm01

    Hi,
    While creating material master user after selecting a particular plant user sees all the storage locations available in the system.How to restrict the storage location list applicable to particular plant while material creation
    Best Regards,
    BM

    Hi,
    As Mahesh said , you need to put validation there, please contact your development team for this.
    Though you are able to see all storgae location you are not able to create the material master, it throws as error if you select incorrect storage location which is not maintained for that particulare plant.
    It gives an error message
    Entry Plant SL  does not exist in T001L (check entry)
    So user will not be able to create material master for improper plant SL combination.
    Thanks,
    Ravi

  • How do I create a new calendar for the current year, using last years calendar's birthday's/photos and comments from the lower pages?

    Each year for the past 5 years I make a family calendar and send copies to all he family members around the globe.  I hate that I have to recreate all the birthdays and special occasions from scratch, and re-drag all the photos onto these dates, in the lower half of the page of each month on the new calendar.  How can I create a new calendar for the current year and port all of these photos/comments into the new calendar from last years calendar, to save having to redo all this work!!  I am not talking about the upper half page of the photos only...I am referring to the calendar page of each month.
    Thanks in advance. 
    Colin

    Welcome to the Apple Discussions. Open iWeb so you see your original site in the left hand pane. Use the File->New Site menu option to create a new site. Give it the name you want.
    Now select a page in your original site and type Command+D. That will duplicate the page. Drag the duplicate page down to the new site and rename it as needed. Do that for the other pages you need in the original site.
    OT

  • Apple ID for my 9 year old - How can I set up an ID for my 9 years old. We have bought him an ITouch for his birthday, he also has a $30 iTunes card. To load up the iTunes card he needs an ID. When I try to set him up it says he is below the min age.

    How can I set up anApple ID for my 9 years old. Every time I try it tells me he is bolew the min age. If this is the case how can he download free games and how can he redeem his birthday $30 iTunes card? I dont want him to use my ID as it has my credit card details.
    I'm very fustrated with this as it seems the Apple kit is for 13 years and older only.
    Cheers
    Brad

    That's great your 9-yr-old is responsible enough to handle an iTouch!
    There's no way around the age limit. I suggest a family account that you, an adult, control.

  • HT1904 how do we create an Apple ID for our 10 year-old daughter?

    how do we create an Apple ID for our 10 year-old daughter?

    The answer is here : http://support.apple.com/kb/HT201084?viewlocale=en_US&locale=en_US

  • How to set a default Billing type for a particular Delivery type

    Dear All,
    How to set a default billing type for a particular delivery type.
    My requirement is, we are creating delivery for a Stock Transport Order. Delivery type is NL and the Purchase order type is UB.
    When we are creating Billing, it should take Billing type "ZSTO" by default, which is the customised Billing type.
    Where we have to do this setting?
    In case of normal sales order, this control will be available in the Sales order document types.
    In case STO, how to set a default billing type for a delivery type (NL).
    Regards,
    Rajesh

    There is a customization available here no default or hard coded
    Normally in a sales doc type we mention which billing type system has to pick
    If the billing happens from a PO which billing type system will take depends on the controls set in the areas mentioned below
    Go to your delivery type OVLK (say your delivery type is NL)
    In that there is a field called default order qty in the order reference tab (say if you maintained DL there)
    This DL is called PSEUDO order type
    Then in VOV8 for DL based on the billing types mentioned ,system will take the billing doc
    For delivery related billing say if you mention say ZF8 in the details of DL in VOV8(provided you have created ZF8)
    Then while you bill the delivery doc of NL system will take ZF8
    For intercompany delivery you can create ZIV billing type also Pure customization
    PO is linked to delivery type ( MM spro settings)--Del type linked to order (pseudo) type---in order type (pseudo) we mention the billing types. Here the flow is bit different that pure SD flow
    Though the invoice is crated by manually putting customized Biiling Type and A/Cing doc also generated, but in the VF04 still system shows the same deliveries pending with Billing Type (F2).
    This manual is not reqd if the said assignments are done properly
    Hope it can assist you.
    Thanks & Regards
    JP
    Edited by: J Prakash on Jun 23, 2010 4:05 PM

  • How can i find the exact BADI For a Particular Transaction

    hi ppl,
    How can i find the exact BADI For a Particular Transaction. Is there any Standard transaction or Programs to do this or suggest some other way.

    Use this code:
    *& Report  ZGET_BADI
    REPORT  ZGET_BADI.
    TABLES : TSTC,
    TADIR,
    MODSAPT,
    MODACT,
    TRDIR,
    TFDIR,
    ENLFDIR,
    SXS_ATTRT ,
    TSTCT.
    DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
    DATA : FIELD1(30).
    DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.
    PARAMETERS : P_TCODE LIKE TSTC-TCODE,
    P_PGMNA LIKE TSTC-PGMNA .
    DATA wa_tadir type tadir.
    START-OF-SELECTION.
    IF NOT P_TCODE IS INITIAL.
    SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
    ELSEIF NOT P_PGMNA IS INITIAL.
    TSTC-PGMNA = P_PGMNA.
    ENDIF.
    IF SY-SUBRC EQ 0.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'PROG'
    AND OBJ_NAME = TSTC-PGMNA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    IF SY-SUBRC NE 0.
    SELECT SINGLE * FROM TRDIR
    WHERE NAME = TSTC-PGMNA.
    IF TRDIR-SUBC EQ 'F'.
    SELECT SINGLE * FROM TFDIR
    WHERE PNAME = TSTC-PGMNA.
    SELECT SINGLE * FROM ENLFDIR
    WHERE FUNCNAME = TFDIR-FUNCNAME.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'FUGR'
    AND OBJ_NAME EQ ENLFDIR-AREA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    ENDIF.
    ENDIF.
    SELECT * FROM TADIR INTO TABLE JTAB
    WHERE PGMID = 'R3TR'
    AND OBJECT in ('SMOD', 'SXSD')
    AND DEVCLASS = V_DEVCLASS.
    SELECT SINGLE * FROM TSTCT
    WHERE SPRSL EQ SY-LANGU
    AND TCODE EQ P_TCODE.
    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE:/(19) 'Transaction Code - ',
    20(20) P_TCODE,
    45(50) TSTCT-TTEXT.
    SKIP.
    IF NOT JTAB[] IS INITIAL.
    WRITE:/(105) SY-ULINE.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    *Sorting the internal Table
    sort jtab by OBJECT.
    data : wf_txt(60) type c,
    wf_smod type i ,
    wf_badi type i ,
    wf_object2(30) type C.
    clear : wf_smod, wf_badi , wf_object2.
    *Get the total SMOD.
    LOOP AT JTAB into wa_tadir.
    at first.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 'Enhancement/ Business Add-in',
    41 SY-VLINE ,
    42 'Description',
    105 SY-VLINE.
    WRITE:/(105) SY-ULINE.
    endat.
    clear wf_txt.
    at new object.
    if wa_tadir-object = 'SMOD'.
    wf_object2 = 'Enhancement' .
    elseif wa_tadir-object = 'SXSD'.
    wf_object2 = ' Business Add-in'.
    endif.
    FORMAT COLOR COL_GROUP INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 wf_object2,
    105 SY-VLINE.
    endat.
    case wa_tadir-object.
    when 'SMOD'.
    wf_smod = wf_smod + 1.
    SELECT SINGLE MODTEXT into wf_txt
    FROM MODSAPT
    WHERE SPRSL = SY-LANGU
    AND NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    when 'SXSD'.
    *For BADis
    wf_badi = wf_badi + 1 .
    select single TEXT into wf_txt
    from SXS_ATTRT
    where sprsl = sy-langu
    and EXIT_NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    endcase.
    WRITE:/1 SY-VLINE,
    2 wa_tadir-OBJ_NAME hotspot on,
    41 SY-VLINE ,
    42 wf_txt,
    105 SY-VLINE.
    AT END OF object.
    write : /(105) sy-ULINE.
    ENDAT.
    ENDLOOP.
    WRITE:/(105) SY-ULINE.
    SKIP.
    FORMAT COLOR COL_TOTAL INTENSIFIED ON.
    WRITE:/ 'No.of Exits:' , wf_smod.
    WRITE:/ 'No.of BADis:' , wf_badi.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'No userexits or BADis exist'.
    ENDIF.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'Transaction does not exist'.
    ENDIF.
    AT LINE-SELECTION.
    data : wf_object type tadir-object.
    clear wf_object.
    GET CURSOR FIELD FIELD1.
    CHECK FIELD1(8) EQ 'WA_TADIR'.
    read table jtab with key obj_name = sy-lisel+1(20).
    move jtab-object to wf_object.
    case wf_object.
    when 'SMOD'.
    SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
    CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
    when 'SXSD'.
    SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
    CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
    endcase.
    Regards
    Vinayak

  • HT1904 how do i set up an account for my 11 year old?

    how do i set up an accound for my 11 year old?

    Create a NEW account/ID for her using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before. You have to enter a birthdate that results in an age of at least 13 years.
      Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card

  • How to restrict the functions in People Enter and Maintain - Others LOV

    I want to restrict the functions appearing when i click on People Enter and Maintain -> Others screen.
    Can this be done through form personalization ?
    If not how can this be achived.
    I want to restrict the list in Assignmnet -> Others list also.
    Thanks in advance
    -Debojyoty

    Change the underlying taskflow.
    In the form function parameters, you can find the taskflow name for the WORKFLOW parameter.
    Make a copy of the seeded taskflow and add/remove nodes as you wich.
    4 nodes in a taskflow can be checked to appear as a button, if you have more nodes linked to the form, they will appear under the other button.
    This is configuration, no customization or personalization!

  • How to restrict the user in MIRO for not modifying  price

    Hi All 
    My requirement is How to restrict the users in MIRO screen for not modifying Material Prices  of only the for specific  ROH types .
    For example :
    Valuation class             RM description
      3021                             RM - A
      3022                             RM - B
      3024                             RM - C
    when ever we procure  the above Raw materials A,B and C and
    the Quantity of each Raw material @ 10 units  and value @ 1 INR  for each unit
    RM - A procured qty 10 @1 total price is INR  10
    RM - B procured qty 10 @1 total  price is INR 10
    RM - C procured qty 10 @1 total  price is INR 10
    total price of PO is INR 30
    when we received invoice material prices are  assume it INR 1 is excess for each material.Now the invoice price for each RM has become INR 11.
    in MIRO we want restrict the user to change the price from INR 10 to 11.
    suggest the best possible ways to restrict in MIRO screen
    Thanks & Regards
    Mala

    Dear:   
                      Take help of ABABPER fo implement exit using INVOICE_UPDATE or MRMH0003 Logistics Invoice Verification: Revaluation/RAP exit. If this does not help then seek help of MM functional who will help you to find exit for the required task.
    rEGARDS

  • How to use the functionality of Simulation for the Transaction MIRO

    Hi Group,
    I have a requirement to call SAP from MS Excel and check for the SImulation option as under:
    The Excel will pass the values of Invoice Number, Posting date, PO number, PO Item number, Company code and etc., through the call of BAPI   -   'BAPI_INCOMINGINVOICE_CREATE'  in order to create Invoice in the SAP system.
    But the above BAPI is creating the Invoices in SAP system. Rather, I need to just check(thru SIMULATION) the records and come back to MS Excel with the MIRO numbers that will be created and the errror messages that will be returned back.
    In summary, I have to add two Buttons as:
       POST : this has to create MIRO(invoice Numbers) in the SAP System(populating the Success/Error Messages by calling
                   the above BAPI   -  This functionality is working fine now
       SIMULATE: this has to do  same functionality of "POST" option but should not create MIROs in the SAP system
                          Currently I am not able to achieve this as the above BAPI is creating MIROs in SAP.
    Kindly provide your inputs on how to go about incorporating the above SIMULATION functionality, by giving some simulation BAPIs that can be used for my functionality.
    Thanks for your help in advance.
    Regards,
    Vishnu.

    Hi Group,
    In continuation to my previous posting, I would like to give more inputs as under:
    when I was using the BAPI - BAPI_INCOMINGINVOICE_CREATE (unless I commit the transaction), MIRO would not be created in the system.
    Now, when I run the BAPI again with a different set of data, the Invoice Number is getting incremented by one.... this I dont need, if the Invoice is not committed and if I run the next time, I need to get the same Invoice Number....
    How can I achieve this task?
    Kindly let me know your inputs on this.
    Regards,
    Vishnu.

  • How to restrict Intercompany Invoice getting generated for receive only trn

    Hi All,
    I have a businesss scenario, where there are two operating units (A and B) Intercompany shipping relationship is set between these two OU's
    Operating Unit: A and Inventory Org: ZZ
    Operating Unit: B and Inventory Org: DEF
    1. If I have Sales order from A and shipped from B OU Inv org(DEF Inv org) , IC AR and IC AP gets generated and also End customer Invoice in A OU gets create
    assume the above order was for 10 Qty shipment
    at Inventory Logical transactions will be created in ZZ Inv org for 10 Qty shipment
    now if the customer comes backs and says you have shipped 12 Qty and returns the 2 Qty, here we dont send any credit Invoice to customer so RMA Order line type is Receive only when you raise RMA order in OU A aganist DEF Inv org (OU B) and you receive the goods in DEF, system creates logical transactions in ZZ inv org which is in OU A and forcing to create IC AR and IC AP in both the OU's, how to restrict the same
    Ideally its extra shipment done from DEF ware house and they are receiving back
    Thanks in advance
    Regards
    Krishna

    Hi All,
    I have a businesss scenario, where there are two operating units (A and B) Intercompany shipping relationship is set between these two OU's
    Operating Unit: A and Inventory Org: ZZ
    Operating Unit: B and Inventory Org: DEF
    1. If I have Sales order from A and shipped from B OU Inv org(DEF Inv org) , IC AR and IC AP gets generated and also End customer Invoice in A OU gets create
    assume the above order was for 10 Qty shipment
    at Inventory Logical transactions will be created in ZZ Inv org for 10 Qty shipment
    now if the customer comes backs and says you have shipped 12 Qty and returns the 2 Qty, here we dont send any credit Invoice to customer so RMA Order line type is Receive only when you raise RMA order in OU A aganist DEF Inv org (OU B) and you receive the goods in DEF, system creates logical transactions in ZZ inv org which is in OU A and forcing to create IC AR and IC AP in both the OU's, how to restrict the same
    Ideally its extra shipment done from DEF ware house and they are receiving back
    Thanks in advance
    Regards
    Krishna

  • How to restrict from creating the  Network for  1st & 2nd level  WBS

    Hi All,
        In our project structure we have up to 5 levels of WBS, In some cases we have creates  3 level also . Now we want to restrict creates Network for first two level WBS  , actually we want to restrict user to Create PR for those WBS so if we restrict them from creation of Network for 1st &  2nd level then they not able to create PR for same  .
    Thanks,
    Virendra

    Hi Virendra,
    I can suggest you other way round solution.
    If you are sure that those two WBS will not take any actual or commitment cost, then its better to NOT to mark those WBS elements as Account Assignment Element. I mean, if you do not set the indicator of Acct. Assignment Element (Untick Acct Assignment Element) on those WBS, then user will not be able to create Networks on those WBS Elements. Try this on your development or quality client and let me know if it works.
    If it works, then you just need to disabled the Acct. Assignment Element indicator for those two WBS element and you can achieve that through substitution and field selection of WBS as well.
    OR
    Just look at OPSG settings at tab component. Just look if that can solve your purpose because your requirement is to stop PR from those WBS element. (I am just wondering if you can stop user from creating/change material components from those WBS-Networks)
    OR
    Go for User Status and set it to on those WBS Elements. Object Types will be Networks and Network Header.
    OR
    Try to achieve a validation or substitution where in you can mark Res./Pur. Req as 1 (Never) only for those two WBS elements. In this way user cannot create PR on those two WBS elements.
    Regards,
    Amit

  • How to disable disclosureClosedIcon on a tree for a particular node ?

    How can I selectively disable the disclosureClosedIcon in  front of a particular tree node and leave the other tree nodes unaffected. If I do myTree.setStyle("disclosureClosedIcon",null);
    Then the whole tree is affected. Please look at the code below.
    <?xml version="1.0" encoding="utf-8"?> 
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.events.ListEvent; 
    import mx.controls.Alert; 
    import mx.events.TreeEvent;[
    Bindable] 
    public var selectedNode:XML; 
    public function myTreeOpening(event:TreeEvent):void { 
    //How to do the following selectively just for one node. For example if I want to just disable
    //further opening of "Marketing" node and leave the other two
    Alert.show(
    "Trying to disable the disclosureClosedIcon just for the Marketing node"); 
    //myTree.setStyle("disclosureClosedIcon",null);
    ]]>
    </mx:Script>
    <mx:XML
    id="treeData">
    <node label="Mail Box">
    <node label="Inbox">
    <node label="Marketing">
    <node label="Professional"/>
    <node label="Individual"/>
    <node label="team"/>
    </node>
    <node label="Product Management">
    <node label="Professional"/>
    <node label="Individual"/>
    <node label="team"/>
    </node>
    <node label="Sales">
    <node label="Professional"/>
    <node label="Individual"/>
    <node label="team"/>
    </node>
    </node>
    </node>
    </mx:XML>
    <mx:Panel
    title="Tree Control Example" height="75%" width="75%" paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
    <mx:Label width="100%" color="blue" text="Select a node in the Tree control."/>
    <mx:Tree id="myTree" width="50%" height="100%" labelField="@label" showRoot="
    false" dataProvider="{treeData}" itemOpening="myTreeOpening(event)"/>
    </mx:Panel>
    </mx:Application>

    Thank you
    but I don't want to modify the underlying xml data by adding isBranch on the node. I just want to modify the display of the data on Tree. The reason is that the xml data is retrieved from database and I can not  modify the XML.

Maybe you are looking for

  • Photoshop closes when I try to open a file

    I have CS5 and Photoshop opens fine. However, when I try to open a file, photoshop closes immediately. I re-installed photoshop and the same thing happens. How do I fix this?

  • Apple TV (1st Gen) can't find update...

    I recently got a 1st gen Apple TV from a friend who no longer wanted it. In order to completely reset it for my use, i ran a system restore using the Menu + - combination and it restored to 1.0 (It was one of the first 40GB units released) The issue

  • Wildcards in classpath

    Hi, I am trying to deploy an application with a 3rd party API which has 10 .jar files. Is there a way I can use wildcards to specify these 10 .jar files? Basically I need to add all the .jar files from the main application folder to the classpath. I

  • How can i tell if i have flashback malware

    How can I tell if I have the flashback malware? Will installing the latest security update get rid of the malware /virus and protect my computer?

  • Samsung LED TV

    Im looking to buy the samsung LED TV, i wanted to know if i can get the tv in 80''. if so how much and how can i get the tv. thanks