Calculating your Essbase Cube [ 170 ] Do this instead: FIX(@IDESCENDANTS("Calendar Periods" AND @LEVMBRS("Calendar Periods",0)) Any Calculation Function; ENDFIX In the following examples, we will show you how to narrow down the amount of data you will calculate in your database for various scenarios. Basic FIX and ENDFIX examples To begin with, as mentioned earlier, FIX and ENDFIX commands can be nested. We have also given you some tips regarding when to use the FIX and ENDFIX commands and what to avoid when nesting them, like the same dimensions named in separate FIX commands. For starters, this is how you would code the simplest of FIX and ENDFIX commands: FIX(@IDESCENDENTS("Calendar Periods")) "Gross Stock" = "Production" – "Sales"; ENDFIX Notice how the FIX command has an area to list selection dimensions. Within the parenthesis you can list multiple dimension names separated by commas, member names, or a list of member functions that returns member names. There are also functions that return members at specic levels in the outline. You can even use basic structuring similar to a mathematical formula with AND/OR statements bracketed by extra parenthesis. In the example immediately above, notice how we are calculating the value for Gross Stock for all Calendar Periods. If your database was extremely large, with several years of historical data in it, this would be inefcient to always calculate the entire Time dimension. Now, suppose you added User Dened Attributes (UDAs) to the periods in the time dimension and only wanted to calculate current periods? Here is what you would do: 1. Add UDAs of Historical, Current, and Forecast to the individual year members and their children in the database outline. For example, if the current calendar year is 2009, then 2009 and all of its children would have the UDA of Current added to them in the outline. All years and their children prior to 2009 would get the UDA of Historical. All years and their children later than 2009 would get the UDA of Forecast added in the outline: This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Chapter 5 [ 171 ] 2. Decide that you only want to calculate Gross Stock for the Current and Forecast time periods. 3. Recode your FIX and ENDFIX command statements to look like this: FIX(@UDA("Calendar Periods","Current") OR @UDA("Calendar Periods","Forecast")) "Gross Stock" = "Production" – "Sales"; ENDFIX Aren't FIX and ENDFIX commands the greatest? Always remember with FIX and ENDFIX, you want to Fix on Sparse dimensions and IF on Dense dimensions. EXCLUDE/ENDEXCLUDE Well there you have it! With the release of Essbase version 9.x we now have EXCLUDE and ENDEXCLUDE commands to compliment the FIX and ENDFIX commands. Now, without confusing you, we can tell you to consider the FIX and ENDFIX commands as an include statement that tells Essbase what data to keep for calculating. And, if including data proves difcult (and there are times it will), then you now have the EXCLUDE and ENDEXCLUDE commands to tell Essbase what data to leave out when selecting data for calculating. See examples in the next section. This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Calculating your Essbase Cube [ 172 ] When we talked earlier about Essbase database calculation control, we meant the FIX and ENDFIX commands. Well, we also mean the EXCLUDE and ENDEXCLUDE commands. These commands complete the data control gate keeper job in the Essbase database calculation script. The EXCLUDE and ENDEXCLUDE command is only for use in an Essbase database calculation script. When you code a member formula, the formula applies only to the member in which it is coded, there is no need for EXCLUDE and ENDEXCLUDE commands. Because these database calculation commands are coded exactly like the FIX and ENDFIX commands, we do not believe that we need to spend a great deal of time explaining what should be obvious as far as the syntax is concerned. Remember the following points while using the EXCLUDE/ENDEXCLUDE command: • You can nest EXCLUDE and ENDEXCLUDE command statements. However, make sure you only code arguments for a dimension in one EXCLUDE statement no matter how many nested levels you have similar to the FIX command. • You can code many instances of EXCLUDE and ENDEXCLUDE commands in the same calc script. • You must have an ENDEXCLUDE for every occurrence of the EXCLUDE command. • You do not need to end an EXCLUDE or ENDEXCLUDE statement with a semi-colon. • You code a comma separated list of members or functions that return a list of members between the parentheses on the EXCLUDE command. • The EXCLUDE statement tells Essbase what data to leave out of the calculation. Basic EXCLUDE/ENDEXCLUDE examples To begin with, as mentioned earlier, EXCLUDE and ENDEXCLUDE commands can be nested. We have also given you tips regarding when to use the EXCLUDE and ENDEXCLUDE commands and what to avoid when nesting them, like the same dimensions named in separate EXCLUDE commands. For starters, this is how you would code the simplest of EXCLUDE/ENDEXCLUDE commands: EXCLUDE("Canada") "Gross Stock" = "Production" – "Sales"; ENDEXCLUDE This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Chapter 5 [ 173 ] Notice how the EXCLUDE command has an area to list dimensions. Within the parenthesis you can list dimension names separated by commas, member names, or a list of member functions that return member names. There are also functions that return members at specic levels in the outline. You can even use basic structuring similar to a mathematical formula with AND/OR statements bracketed by extra parenthesis. In the example immediately above, notice how we are calculating the value for Gross Stock for all markets except Canada. There has not been a tremendous amount of feedback regarding the use and performance of EXCLUDE and ENDEXCLUDE as they are new in version 9.x. We can only assume that the EXCLUDE and ENDEXCLUDE commands function exactly like the FIX and ENDFIX commands, except to exclude the referenced data instead of including the referenced data. Aren't EXCLUDE and ENDEXCLUDE commands the greatest as well? Functional In Essbase database calculation scripts, you may be required to perform certain functional commands like Set functions, Cleardata functions, or the Datacopy function that is used to copy data from one member to another member, all before you start the execution of your database calculation. SET command functions SET command functions are used to tune the calculation and database factors that affect calculation performance and are initially coded at the beginning of a calculation script. SET commands stay in effect for the duration of the calc script unless coded again mid-script. Let's take a look at some of the widely used SET command functions: • SET AGGMISSING ON/OFF: This command species if Essbase should turn the consolidation of the # missing values ON or OFF. This is only applicable to Sparse dimensions. Example: SET AGGMISSING ON; SET AGGMISSING OFF; This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com Calculating your Essbase Cube [ 174 ] • SET CACHE HIGH/DEFAULT/LOW/OFF/ALL: In the Essbase conguration le, if you have specied values for the CALCCACHELOW, CALCCACHEHIGH, and CALCCACHEDEFAULT, then when you run a database calculation script you set the calculator memory cache to HIGH, LOW, or DEFAULT. When you preset these values in the script (as needed), you can realize a better performance while the script is executing. The Essbase conguration le is stored in the Essbase program directory on the server. This le can contain many entries for tweaks and adjustments that help your Essbase system perform better. The Essbase Conguration le is explained in more detail in Chapter 9 of this book. Let us say the following are the settings for the calc cache in the Essbase conguration le. Oops! We introduced a new term here. The Essbase conguration le is new and we have not talked about it yet. Well, we will discuss the conguration le in the coming chapters. However, for now know that it is a le where you can set up your server settings and adjustments which improve the overall performance of data loads and data calcs. Now, where were we? Oh yes, the server calc cache settings: CALCCACHEHIGH 150000000 CALCCACHEDEFAULT 100000000 CALCCACHELOW 50000000 In the Calculation Script you have dened: SET CACHE HIGH; This command sets the calculator cache to 150,000,000 bytes. SET CACHE DEFAULT; This command sets the calculator cache to 100,000,000 bytes. SET CACHE LOW; This command sets the calculator cache to 50,000,000 bytes. • SET CALCTASKDIMS n: Species the number of Sparse dimensions that can run in parallel, where n is maximum number of Sparse dimensions. This command can help speed up the performance of a calculation script by identifying tasks or transactions that can be run in parallel instead of serially. SET CALCTASKDIMS 1 In the above command, the last Sparse dimension is identied as the task that can run in parallel. • SET CALCPARALLEL n: Enables the calculation tasks to run in parallel, where n is number of threads. The value of n can be 1 to 4 for 32 bit and 1 to 8 for 64 bit servers. SET CALCPARALLEL 4 This material is copyright and is licensed for the sole use by Paul Corcorran on 5th July 2009 8601 ave. p #1, , lubbock, , 79423 Download at Boykma.Com . by Paul Corcorran on 5th July 20 09 8601 ave. p #1, , lubbock, , 794 23 Download at Boykma.Com Calculating your Essbase Cube [ 172 ] When we talked earlier about Essbase database calculation control,. Corcorran on 5th July 20 09 8601 ave. p #1, , lubbock, , 794 23 Download at Boykma.Com Calculating your Essbase Cube [ 174 ] • SET CACHE HIGH/DEFAULT/LOW/OFF/ALL: In the Essbase conguration le,. current calendar year is 20 09, then 20 09 and all of its children would have the UDA of Current added to them in the outline. All years and their children prior to 20 09 would get the UDA of Historical.