Formula : If - Elseif

Hi all,
I have 6 Calculated Key Figured and based on theirs values i need a Formula Key Figured, in order to do this i need to add a logical expresion in FKF; something like that: (CKF1= calculated key figured, XXX some operation)
If (CKF1 <>0)
  XXXX
elseif (CKF2 <> 0)
  XXXX
elseif (CKF3 <> 0)
  XXXX
elseif (CKF4 <> 0)
  XXXX
elseif (CKF5 <> 0)
  XXXX
Else
  XXXX
Endif
I will assign point !! please, help me !!
Regards

Hi Sab,
Check this thread, which gives a clear explanation of a scenario like yours.
Formula in BEx
If you need any further assistance, let me know
Regards,
R.Ravi
*Assigning points is the way of saying Thanks in SDN

Similar Messages

  • Change The Color Of Fomula Field Based On Results

    I am using Crystal XI and I am familar with the Highliting Expert, but my question is can I have a formula field print red on the report based on a certain condition, blue on a different condition, etc. I am not sure how to code this if possible, so I will give an example:
    If Sales ($100) - Cost ($50) = Profit ($50) then print field red
    else if Sales ($80) - Cost ($40) = Profit ($40) then print field green
    else print field blue.
    I will need to add additional criteria to each IF statement which is why I am not using the Highliting Function, so my basic question is how to code the formula to have field field print different colors based on the field values.
    Any help would be geatly appreciated.
    Thanks Jim

    Hi Jim,
    Right click the field >> Format >> Font Tab.
    Find 'color' >> Click the little icon with a pencil and X-2 symbol to open the formula box.
    Place your formatting formula in the box:
    If @Sales - @Cost < 0 Then
         Formula = crRed
    ElseIf @Sales - @Cost >= 50 Then
         Formula = crGreen
    Else
         Formula = crBlue
    End If
    Full list of Color Constants are in the functions list of the Formula Editor.
    Art

  • IF Statement in Member formula V11 -EPMA

    Hi,
    As any one used IF and ENDIF statement in the member formula on EPMA V11? I am using the same but it fails to deploy and I have no clue whatsoever.
    Does it require an expression OpenInputvaluebox and closedInputvaluebox
    Thanks in advance

    Hi,
    This is the member formula formula I am trying to load:
    IF (@IsMbr("Local"))
    IF (@IsMbr(Hsp_InputValue))
    IF (@IsMbr("No Year"))
    IF (@IsMbr("BegBalance"))
    IF (@IsMbr("Forecast"))
    "RTD" = "Apr"->"Periodic" ->&FcstYear1: "Mar" ->"Periodic"->&FcstYear1;
    ELSEIF (@IsMbr("RF1"))
    "RTD" = ("Jul"->"Periodic" ->&FcstYear1: "Mar" ->"Periodic"->&FcstYear1) + ("Apr"->"Periodic"->&FcstYear2 : "Jun"->"Periodic"->&FcstYear2);
    ELSEIF (@IsMbr("RF2"))
    "RTD" = ("Oct"->"Periodic" ->&FcstYear1: "Mar" ->"Periodic"->&FcstYear1) + ("Apr"->"Periodic"->&FcstYear2 : "Sep"->"Periodic"->&FcstYear2);
    ELSEIF (@IsMbr("RF3"))
    "RTD" = ("Jan"->"Periodic" ->&FcstYear1: "Mar" ->"Periodic"->&FcstYear1) + ("Apr"->"Periodic"->&FcstYear2 : "Dec"->"Periodic"->&FcstYear2);
    ENDIF;
    ENDIF;
    ENDIF;
    ENDIF;
    ENDIF;
    Is there a syntax error here?
    Cheers

  • Message in BEx Query Designer Formula

    Hi Experts,
    I need to display message based on the value of the formula result. For Example:
    If K.F1 =<2.5 Then <Message: ODD>
    ElseIF K.F1 >2.5 Then <Message: Even>
    Else
    <Message: Determine the value>
    EndIF
    Thease above messages would be build in the formula column of BEx query designer
    Thanks and really appreciate your response.
    Regards,
    Waseem

    Hello,
    I have done the same funtionality with the help of workbook.
    May be experts can guide us how to display  messages in the formula column of BEx query designer.
    Thanks.
    With regards,
    Anand Kumar

  • Member Formula Verifies in EAS but not Planning.  Error [1200497]

    All I am trying to construct a member formula with multiple IF statements. The formula will verify and work in EAS but when we try to refresh the database from planning we receive the error 1200497. We are on version 11.1.13. The offending member formula is below. Any help with what may be wrong is appreciated.
    If (@ismbr("020 Pallet","020 Case","020 Each"))
         If ("Tier 2 Low" == #missing)
              "Tier 1 Price";
         Elseif ("Volume"->"020 Bulk Fulfillment"<"Tier 2 Low")
              "Tier 1 Price";
         Elseif ("Volume"->"020 Bulk Fulfillment"<"Tier 3 Low")
              "Tier 2 Price";
         Elseif ("Volume"->"020 Bulk Fulfillment"<"Tier 4 Low")
              "Tier 3 Price";
         Elseif ("Volume"->"020 Bulk Fulfillment"<"Tier 5 Low")
              "Tier 4 Price";
         Elseif ("Volume"->"020 Bulk Fulfillment"<"Tier 6 Low")
              "Tier 5 Price";
         Else
              "Tier 6 Price";
         Endif;
    Else
         If (@ismbr("014-003","014-004","014-034","014-035"))
              If ("Tier 2 Low" == #missing)
              "Tier 1 Price";
              Elseif ("Volume"->"014 QA"<"Tier 2 Low")
              "Tier 1 Price";
              Elseif ("Volume"->"014 QA"<"Tier 3 Low")
              "Tier 2 Price";
              Elseif ("Volume"->"014 QA"<"Tier 4 Low")
              "Tier 3 Price";
              Elseif ("Volume"->"014 QA"<"Tier 5 Low")
              "Tier 4 Price";
              Elseif ("Volume"->"014 QA"<"Tier 6 Low")
              "Tier 5 Price";
              Else
              "Tier 6 Price";
              Endif;
         Else
              If ("Tier 2 Low" == #missing)
              "Tier 1 Price";
              Elseif ("Volume"<"Tier 2 Low")
              "Tier 1 Price";
              Elseif ("Volume"<"Tier 3 Low")
              "Tier 2 Price";
              Elseif ("Volume"<"Tier 4 Low")
              "Tier 3 Price";
              Elseif ("Volume"<"Tier 5 Low")
              "Tier 4 Price";
              Elseif ("Volume"<"Tier 6 Low")
              "Tier 5 Price";
              Elseif ("Volume"<"Tier 7 Low")
              "Tier 6 Price";
              Elseif ("Volume"<"Tier 8 Low")
              "Tier 7 Price";
              Elseif ("Volume"<"Tier 9 Low")
              "Tier 8 Price";
              Elseif ("Volume"<"Tier 10 Low")
              "Tier 9 Price";
         Else
              "Tier 10 Price";
         Endif;
    Endif;
    Endif;

    Is it being applied to plan types that don't include all the members being referenced in the formula, it could be that it validates on one plan type but not another.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Member formula IF statement syntax

    Hi guys
    Can someone assist me with the syntax of the IF statement on a member formula.
    On the measure "Total Cost", i would like to apply a formula which calls value loaded to a series of other measures (m1, m2, m3, etc) such that if the Number of bags is = 1, then a value loaded to M1 is called, and if the Number of bags is 2, a value loaded to m2 is called.
    Thanks

    I think there may a better way to do what you are trying to achieve but below is the syntax for IF statement
    IF("number of bags" == 1)
    "m1";
    ELSEIF("number of bags" == 2)
    "m2";
    ELSEIF("number of bags" == 3)
    "m3";
    ENDIF;

  • IF ELSE Statement in Member Formula

    I believe that I am in my final step of completing my database. But, I need to create a member formula that converts lbs to kg. I have gotten help on this question in the past and have a basic formula that works. However, I have 2 exceptions to the formula that are not successfully calculating.
    This much of the formula has been tested and works when isolated:
    IF (@ISMBR(@LIST(AccountCapacityTypeX,AccountCapacityTypeY,AccountCapacityTypeZ)))
    "LBS"/2.2046;
    ELSEIF ((@ISMBR(@List(AccountCapacityTypeA, AccountCapacityTypeB) )) and (@ISMBR(@LIST(MbrNm1, MbrNm2,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Qtr1","Qtr2","Qtr3","Qtr4"))))
    @round(("LBS"/2.2046),0);
    else
    @round(("LBS"/(2.2046*5)),0)*5;
    ENDIF
    However, the following checks out when I verify my syntax, but when it is added to the above formula the formula does not load:
    IF ((@ismbr(MbrNm3)) and
    (@ISMBR(@LIST("Region1","ParentOfRegion1","GrandparentOfRegion1","Y2008","Y2009","Y2010","Y2011","Y2012","Y2013","Y2014","2015","Y2016","Y2017","Y2018")) and (@ISMBR(@List(AccountCapacityTypeA, AccountCapacityTypeB)))))
    105;
    ENDIF
    IF ((@ismbr(MbrNm4)) and
    (@ISMBR(@LIST("Region1","ParentOfRegion1","GrandparentOfRegion1","Y2012","Y2013","Y2014","Y2015","Y2016","Y2017","Y2018")) and (@ISMBR(@List(AccountCapacityTypeA, AccountCapacityTypeB)))))
    425;
    ENDIF
    Members MbrNm1-4 are all stored, zero level members of the same dimension. My years, months, and qtrs are dense dimensions, everything else is sparce. AccountCapacityTypes contain both calculated and stored members. Region dimension contains all stored members. Also lbs are a stored member.
    Any ideas on how to make these 2 exceptions work?
    Thank you,
    C-Lo

    Hello Cameron Lackpour,
    I have tried several iterations of this calc script, and gotten it to mostly work. The issue that I have is that it calculates everything correctly, but when I @remove the one year that want the calc script to calculate differently that year retrieves values for #missing as desired, but when I try to write a calc script for that single excluded year the second calc script still doesn't run for the whole condition that is defined. I don't know if any of that makes any since, but below is an example:
    FIX("JOLEFINS_JCP")
    FIX(@REMOVE(@RELATIVE("Years", 0), @Member("Y2008")))
    *"KMT"*
    IF (@ismbr(@list("MajorTurnarounds","InventoryCtrl","Feedslate/ProdMixImpct","ActsOfNat","Fdstk/RawMtlAvail",
    *"OtherExtEvents","ExternalLPOs","InternalLPOs","PlndMntc","Mech/ProcLoss","AbvCapProd","Other","Actual","Adjusted","MaxDmstdCap")))*
    *"MMLBS"/2.2046;*
    ELSEIF(@ISMBR("Published Capacities","EOY_PubCap"))
    *@round(("MMLBS"/(2.2046*5)),0)*5-1.25;*
    ENDIF
    ENDFIX (everything in bold is calculating correctly)
    FIX (@RELATIVE("Years", 0), @member("2008"))
    +"KMT"+
    +(+
    IF (@ismbr(@list("MajorTurnarounds","InventoryCtrl","Feedslate/ProdMixImpct","ActsOfNat","Fdstk/RawMtlAvail",
    +"OtherExtEvents","ExternalLPOs","InternalLPOs","PlndMntc","Mech/ProcLoss","AbvCapProd","Other","Actual","Adjusted","MaxDmstdCap")))+
    +"MMLBS"/2.2046;+
    ENDIF
    IF(@ISMBR("Published Capacities"))
    +@round(("MMLBS"/2.2046),0)/1.08;+
    ENDIF This portion in italics returns #Missing . However, the loaded data ("MMLBS") does return data for this year.
    IF (@ISMBR("EOY_PubCap"))
    *8.75;*
    ENDIF This portion seems to be calculating as well.
    ENDFIX
    ENDFIX
    CALC ALL;
    Any additional suggestions?
    Thanks,
    C-Lo

  • ELSEIF in calculated key figure

    Dear gurus
    We have recently upgraded to NW2004s, and would need some help on the formula for my calculated key figure. This calculated key figure is meant to replicate IF... ELSEIF statement, depending on what the user enters. The logic that we have are as below :
    IF Var=1, then display key figure A
    ELSEIF Var=2, then display key figure B
    ELSEIF Var=3, then display key figure C
    ELSEIF Var=4, then display key figure D
    where Var is a Formula Variable, Processing By User Entry/Default value.
    The formula that we have originally, in BW3.5 is :
    <i>(Var == 1) * 'Amount in TC' + (Var== 2) * 'Amount in Comp Code' + (Var == 3) * 'Amount in Parall USD' + (Var == 4) * 'Amount in Hard Cur' </i>
    This formula has served us well in BW 3.1 to BW 3.5, and never had any problems with it. However, when we migrated over to BW 7.0, we could not get values for this formula (eventhough we have data in our cubes). The only data that get is when we key in Var=1, but when we try with Var=2, 3 or 4, no data is displayed in our key figure.
    We tried to debug, but somehow we could not figure out how the new BW7.0 calculates these type of key figures, and whether is there a change in the formula variable. We believe that the problem may lie in the way that BW 7.0 interprets the formula above, and only obtains the first portion of the formula (Var==1).
    We would appreciate any helps, and of course, points will be awarded if problem can be solved.
    Thanks a lot

    Dear all
    With some luck in searching, I manage to find an OSS note which depicts this error and resolve it. For those who have the same problem, please use this OSS Note 994194.
    Cheers

  • Issue with Formula on Brand Family Level

    Hi Friends,
    we are facing issue with the formula while showing the report output.
    Following is the scenario.
    BrandFamily(Char),Material(Char),Comp(Char), Kf1(Keyfig) ,Kf2(Keyfig)
    Data Records:
    1st Record  -
    >    B1, M1,  200, 100
    2nd Record -
    >    B1, M2,  500, 400
    3rd Record -
    >   B2, M3,  100,  300
    4th Record -
    >   B2, M4,  600, 200
    Formual --> If Kf1>Kf2 then Kf1 Elseif Kf1<Kf2 then Kf2
    1) Report displayed based on the BrandFamily and Material , then the report shows correctly as below
    Report Structure :- Brandfamily , Material are in Rows and the Colum has the Formula (that was mentioned above)
    Report Output :-
    B1 M1 200
    B1 M2 500
    B2 M3 300
    B2 M4 600
    On Summing , For B1 , Value is 700. For B2, Value is 900.
    2) 1) Report displayed based on the BrandFamily , then the report  shows wrongly for the formula value  as shown below
    Report Structure :- Brand Family is in Rows and the Colum has the Formula (that was mentioned above)
    Report Output:-
    B1 700
    B2 700
          Here For B1, Value is 700 which is matching with the earlier output
    Whereas For B2, Value is 700 which is not matching with the earlier output.
    The Value for B2 is wrong because the formula has not processed correctly the 3rd record .
    The report summed up the 3rd and 4th records and then applied the formula , because of which the issue.
    This is because the Values kf1 and Kf2 are based on the material and as the material is not part of the Rows .
    Thankyou in advance.
    LNV

    a more simpler solution.
    open the kf in edit mode which has the condition
    create two formula variables  as follows.
    BRANDFAMILY
    replacement path ,  reference characteristic brand famility
    got replacement path tab-> replacevaue with as ' infobject'  replace with as 'attribute value'  , attribute constant 1.
    MATERIAL
    replacement path ,  reference characteristic material.
    got replacement path tab-> replacevaue with as ' infobject'  replace with as 'attribute value'  , attribute constant 1.
    MODIFY the KF as
    BRANDFAMILY * MATERIAL *  condition.
    had exactly same  requirement

  • Line break/carriage return in formula

    Hi,  I have an IF ELSEIF formula that works fine.  Problem is they now wants the result to show a few paragraph instead of a few words.  Can someone help me figure out how to insert line breaks/carriage returns in a formula.  Thanks.

    This is what I have:
    If (CurrentDate> {@21Days}) OR (CurrentDate >{@LastMonth})THEN "NOTICE OF TERMINATION OF CHILD CARE CONTRACT FOR NON-PAYMENT OF FEES. + chr(10)+ Lets see how to make a paragraph"
    ELSE
    If (CurrentDate<{@LastMonth}) THEN "SECOND WEEK NON-PAYMENT/PARTIAL PAYMENT NOTICE"
    ELSE
    If {tblAROpenDoc.dtmDocDate} in LastFullWeek THEN "FIRST WEEK NON-PAYMENT/PARTIAL PAYMENT NOTICE" ELSE ""
    the chr(10) shows
    Any ideas?

  • Dynamic Calc Member with Formula to Calculate a Rolling 13 Year

    I have to create a rollup in my time dimension that will have 13 members representing each month of a 13 rolling forecast. I am having trouble setting this up as dynamic calc members with a formula assigned to it. For example, on of the members has the following formula.
    As you can see, I am referencing several substitution variables since I want to make this as most dynamic as possible without having to make any changes to the formula member. Only making changes to the substitution variable. Any help would be much appreciated.
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Jan"));
    "RTM 6" = @MDSHIFT(&Act_RF_Last_Month, -1, "Years", , 5, "Period",);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Feb"));
    "RTM 6" = @MDSHIFT(&Act_RF_Last_Month, -1, "Years", , 5, "Period",);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Mar"));
    "RTM 6" = @MDSHIFT(&Act_RF_Last_Month, -1, "Years", , 5, "Period",);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Apr"));
    "RTM 6" = @MDSHIFT(&Act_RF_Last_Month, -1, "Years", , 5, "Period",);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "May"));
    "RTM 6" = @MDSHIFT(&Act_RF_Last_Month, -1, "Years", , 5, "Period",);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Jun"));
    "RTM 6" = @MDSHIFT(&Act_RF_Last_Month, -1, "Years", , 5, "Period",);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Jul"));
    "RTM 6" = @MDSHIFT(&Act_RF_Last_Month, -1, "Years", , 5, "Period",);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Aug"));
    "RTM 6" = @SHIFT(&Act_RF_Last_Month,-7);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Sep"));
    "RTM 6" = @SHIFT(&Act_RF_Last_Month,-7);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Oct"));
    "RTM 6" = @SHIFT(&Act_RF_Last_Month,-7);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Nov"));
    "RTM 6" = @SHIFT(&Act_RF_Last_Month,-7);
    ELSE #Missing;
    ENDIF
    IF((@ISMBR(&Current_Year)) AND (&Act_RF_Last_Month == "Dec"));
    "RTM 6" = @SHIFT(&Act_RF_Last_Month,-7);
    ELSE #Missing;
    ENDIF

    We use similar logic but its in a calc script, not a dynamic formula.
    Here's an example of what we do:
    FIX (&Year, &Scenario)
    IF (@ISMBR("JAN"))
    "Average Usage%" = @AVG(SKIPBOTH, @MDSHIFT("Usage %"->"DEC"->&actYear, -1, "Year",), "Util %"->"JAN"->&actYear);
    ELSEIF
    ENDFIX
    Another example in a different database:
    IF (@ISMBR("JAN")) ((@MDSHIFT("Fees"->APR,-1,YEARS,)+@MDSHIFT("Fees"->MAY,-1,YEARS,)+@MDSHIFT("Fees"->JUN,-1,YEARS,)+@MDSHIFT("Fees"->JUL,-1,YEARS,)+@MDSHIFT("Fees"->AUG,-1,YEARS,)+@MDSHIFT("Fees"->SEP,-1,YEARS,)+@MDSHIFT("Fees"->OCT,-1,YEARS,)+@MDSHIFT("Fees"->NOV,-1,YEARS,)+@MDSHIFT("Fees"->DEC,-1,YEARS,)+"Fees"->JAN)/10)*12;

  • Copying data to member with member formula

    Hi All,
    How do I copy data to a member with member formula? For example, I have a member called "Opening_Balance_Rooms" this member has member formula so storage property is Dynamic Calc. It has data value of 1300 in local currency for post0+12 (Post0+12->Local=1300) and I want to copy the same to USDForecast0+12Rates. Below will explain my requirment clearly. Using Essbase V11.1.1.3.
    Column1........... Column2
    Post0+12.............. Post0+12
    Local.................... USDForecast0+12Rates
    Opening_Balance_Rooms 1300.............. 0 (I want to populate 1300 instead of 0 here)
    Thanks,
    Edited by: MoFa on Sep 4, 2012 1:21 PM
    Edited by: MoFa on Sep 4, 2012 1:23 PM

    Hi Tim,
    This is the member forumula that calculate the Opening_Balance_Rooms.
    IF (@ISMBR ("Jan") AND @ISMBR ("2002 Actuals"))
    Opening_Balance_Rooms = ("OPB_Rooms"->"BegBalance"->"2002 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2003 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2002 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2004 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2003 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2005 Actuals"))
    Opening_Balance_Rooms = ("OPB_Rooms"->"BegBalance"->"2005 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2006 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2005 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2007 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2006 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2007 Actuals Adjustments"))
    Opening_Balance_Rooms = 0;
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2007 Actuals after Adjustments"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2006 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2008 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2007 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2008 Actuals Adjustments"))
    Opening_Balance_Rooms = 0;
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2008 Actuals after Adjustments"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2007 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2009 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2008 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2009 Actuals Adjustments"))
    Opening_Balance_Rooms = 0;
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2009 Actuals after Adjustments"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2008 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2010 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2009 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2010 Actuals Adjustments"))
    Opening_Balance_Rooms = 0;
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2010 Actuals after Adjustments"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2009 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2011 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2010 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2011 Actuals Adjustments"))
    Opening_Balance_Rooms = 0;
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2011 Actuals after Adjustments"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2010 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2012 Actuals"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2011 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2012 Actuals Adjustments"))
    Opening_Balance_Rooms = 0;
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2012 Actuals after Adjustments"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2011 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2004 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2003 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2005 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2004 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2006 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2005 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2007 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2006 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2008 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2007 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2009 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2008 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2010 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2009 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2011 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2010 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2012 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2011 Actuals");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("2013 Target"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2012 Actuals");
    ELSEIF (@ISMBR ("Post0+12")
    OR @ISMBR ("1+11OrigPre") OR @ISMBR ("1+11PrePush") OR @ISMBR ("1+11PreAdj") OR @ISMBR ("Post1+11")
    OR @ISMBR ("2+10OrigPre") OR @ISMBR ("2+10PrePush") OR @ISMBR ("2+10PreAdj") OR @ISMBR ("Post2+10")
    OR @ISMBR ("3+9OrigPre") OR @ISMBR ("3+9PrePush") OR @ISMBR ("3+9PreAdj") OR @ISMBR ("Post3+9")
    OR @ISMBR ("4+8OrigPre") OR @ISMBR ("4+8PrePush") OR @ISMBR ("4+8PreAdj") OR @ISMBR ("Post4+8")
    OR @ISMBR ("5+7OrigPre") OR @ISMBR ("5+7PrePush") OR @ISMBR ("5+7PreAdj") OR @ISMBR ("Post5+7")
    OR @ISMBR ("6+6OrigPre") OR @ISMBR ("6+6PrePush") OR @ISMBR ("6+6PreAdj") OR @ISMBR ("Post6+6")
    OR @ISMBR ("7+5OrigPre") OR @ISMBR ("7+5PrePush") OR @ISMBR ("7+5PreAdj") OR @ISMBR ("Post7+5")
    OR @ISMBR ("8+4OrigPre") OR @ISMBR ("8+4PrePush") OR @ISMBR ("8+4PreAdj") OR @ISMBR ("Post8+4")
    OR @ISMBR ("9+3OrigPre") OR @ISMBR ("9+3PrePush") OR @ISMBR ("9+3PreAdj") OR @ISMBR ("Post9+3")
    OR @ISMBR ("10+2OrigPre") OR @ISMBR ("10+2PrePush") OR @ISMBR ("10+2PreAdj") OR @ISMBR ("Post10+2")
    OR @ISMBR ("11+1OrigPre") OR @ISMBR ("11+1PrePush") OR @ISMBR ("11+1PreAdj") OR @ISMBR ("Post11+1")
    AND @ISMBR ("Jan"))
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2011 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY1+11Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"1+11OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY1+11Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post1+11");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY2+10Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2+10OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY2+10Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post2+10");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY3+9Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"3+9OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY3+9Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post3+9");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY4+8Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"4+8OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY4+8Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post4+8");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY5+7Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"5+7OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY5+7Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post5+7");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY6+6Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"6+6OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY6+6Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post6+6");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY7+5Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"7+5OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY7+5Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post7+5");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY8+4Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"8+4OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY8+4Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post8+4");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY9+3Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"9+3OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY9+3Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post9+3");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY10+2Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"10+2OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY10+2Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post10+2");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY11+1Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"11+1OrigPre");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY11+1Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post11+1");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY0+12Pre") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"Post11+1");
    ELSEIF (@ISMBR ("Jan") AND @ISMBR ("FY0+12Post") )
    Opening_Balance_Rooms = ("Rooms"->"Dec"->"2012 Actuals after Adjustments");
    ELSEIF (@ISMBR ("Feb") OR @ISMBR ("Mar")
    OR @ISMBR ("Apr") OR @ISMBR ("May")
    OR @ISMBR ("Jun") OR @ISMBR ("Jul")
    OR @ISMBR ("Aug") OR @ISMBR ("Sep")
    OR @ISMBR ("Oct") OR @ISMBR ("Nov")
    OR @ISMBR ("Dec"))
    Opening_Balance_Rooms = @Prior("Opening_Balance_Rooms")
    + @Prior("Affiliations")
    + @Prior("Disaffiliations")
    + @Prior("Other_Rooms");
    EndIf

  • How to select last record or first record value in a formula?

    Post Author: d111
    CA Forum: General
    I am using a query in a report that in addition to other columns, has a column of month labels like:
    There are no unique identifiers or sequence fields that can be used.   There is only 4 columns: the label and 3 percent columns.
    Jan07Feb07Mar07Apr07etc.
    I would like to show the range of months I am using in a label on the report showing the last and first records value. like: "Jan07 to Jun07".
    I can not see how to use the functions maximun or minimum since it sorts the months alphabetically.
    I would like to use a formula to just grab the first and last record.  I can't seem to find any information on this anywhere.
    Please advise and thanks.

    Post Author: bettername
    CA Forum: General
    Hmm... I suspect what you actually want is the minimum and maximum dates in the report, rather than the first and last records (even if they do happen to come out in date order). So you need to convert the text dates to real ones, and then pick the min/max values.
    If so, try these:
    Formula "ConvertToDate" (for details section) which converts your text field into a real date - suppress it once placed!:
    //Since you have 2-digit years, this conversion assumes that all your dates are >=year 2000
    numbervar the_month;if left({YourTable.YourField},3) = "Jan" then the_month:=1 elseif left({YourTable.YourField},3) = "Feb" then the_month:=2 elseif left({YourTable.YourField},3) = "Mar" then the_month:=3 elseif left({YourTable.YourField},3) = "Apr" then the_month:=4 else
    //...etc etc you fill in the rest!
    if left({YourTable.YourField},3) = "Dec" then the_month:=12;
    date(tonumber("20"+right({YourTable.YourField},2)), the_month, 1);
    Formula "Show Date Range" (for anywhere on the report) to show the min/max values of the dates;
    totext (minimum({@ConvertToDate})) + " to "+totext(maximum({@ConvertToDate}))
    If, however, you really just want the first and last records, and you want it at the top of your report as a title (eg: in the Report Header), then I can't see how it can be done without using a subreport that looks at the same dataset, but only displays the first and last records (using the formulas below).
    Stick this in the details section, and call it "HoldRecords" and suppress it:
    whileprintingrecords;stringvar first;stringvar last;if recordnumber = 1 then first:={YourTable.YourField}; //if its the first record that crystal is displaying, store it in a variableif recordnumber = count({YourTable.YourField}) then last :={YourTable.YourField} //and again, but for the last record
    Now create another formula, and put it into the report footer:
    evaluateafter({@HoldRecords});stringvar first" to "stringvar last //will display "Jan07 to Apr07"
    NOTE:  if you have the report ordered by anything, this'll throw the record numbering, and therefore the first and last records, therefore... urgh.
    Hope this helps...

  • Formula required to calculate correct YTD Balance values in database

    Hi,
    I've inherited an outline whereby we have a "Year-to-Date" member with the following shared members within it:
    YTD Jan = has "Jan" as a shared member
    YTD Feb = has "Jan & Feb" as shared members
    YTD Mar = has " Jan, Feb & Mar" as shared members
    ... etc.
    I expect this is to give the YTD picture when a user retrieves on the "Year-to-Date" member. This set up works fine for P&L account codes as they clear down at the end of each year to nil and are posted through to Retained earnings so the Jan movement is the "YTD Jan" closing balance.
    However for Balance sheet account codes, they roll over each year and the final YTD balance from the prior year's final period "YTD Adj" needs to carry over to "YTD Jan" opening balance. I tried using this formula on the "YTD Jan" member but am not getting the right result.
    IF (@ISICHILD ("Balance Sheet"))
    IF (@ISMBR ("2008"))
    "2008"->"YTD Jan"-"2007"->"YTD Adj";
    elseif (@ISMBR ("2009"))
    "2009"->"Jan"+"2008"->"YTD Adj";
    elseif (@ISMBR ("2010"))
    "2010"->"Jan"+"2009"->"YTD Adj";
    ENDIF;
    ELSE "Jan";
    ENDIF;
    Is this the right approach?
    Thanks
    Dermott

    garycris wrote:
    Your approach would probably work, but I'm not sure it is the cleanest way to do it. You are also going to have to remember to change it each year and prior year numbers will look wrong (not sure how many years of history you have) There are probably a couple of different ways to do it. Can you post what your base Time hierarchy looks like? Where is the YTD_Adj member in the hierarchy?
    Couple of other questions.
    Is Time dense or sparse?
    Have you attempted to use Dynamic time series and Time balancing functionality?I was aware of the need to change the formula each year garycris, thanks for the reminder :). We currently have 2006 data onwards. (I was going to get the 2009 data working before I rolled back the formula to 2006).
    The Period dimension is Dense.
    The YTD Adj is shown below.
    Our Period (Time) hierarchy looks thus:
    -Outline
    --Period (Time)[Gen1]
    --Year total* [Gen2]
    -Qtr 1[Gen3]
    -Jan (stored) *(<- Data loaded here!)*[Gen4]
    -Feb etc [Gen4]
    -Mar etc [Gen4]
    -Qtr 2[Gen3]
    -Qtr 3[Gen3]
    -Qtr 4[Gen3]
    --Year-to-date*[Gen2]
    -YTD Jan *(<-- Formula loaded here!)*[Gen3]
    -Jan (shared member)[Gen4]
    -YTD Feb[Gen3]
    -Jan (shared member)[Gen4]
    -Feb (shared member)[Gen4]
    -YTD Mar[Gen3]
    -Jan (shared member)[Gen4]
    -Feb (shared member)[Gen4]
    -Mar (shared member)[Gen4]
    -- etc --
    -- etc --
    -YTD Adj[Gen3]

  • BW Transformation formula using If in list statement

    Hi there, I am trying to create some logic with a transformation formula and nested if statements.  I believe that it does not like the IN context.  Can someone tell me how to properly state in list as part of below formula?
    IF( SUBSTRING( PRDHA, 9, 4 ) IN ( '5004', '5089', '5097', '5119', '5013', '5094', '5099', '5114', '5116', '5125', '5136', '5164', '5171', '5183' ), 'S','B')

    Thanks for the responses.
    I ended up utilizing an ABAP routine:
    IF lv_brand = '5004' OR
           lv_brand = '5089' OR
           lv_brand = '5097' OR
           lv_brand = '5119'
    RESULT = 'S'.
    ELSEIF ( lv_brand = '5001' OR
                 lv_brand = '5010' OR
                 lv_brand = '5052') OR
                  ( lv_matnr = '6919' OR
                 lv_matnr = '6939').
          RESULT = 'C'.
    If you want to check if field is empty use IS INITIAL as statement
        ELSEIF lv_brand IS INITIAL.
          RESULT = 'N'.
        ELSE.
          RESULT = 'O'.
        ENDIF.

Maybe you are looking for