The naming convention for variables is: v_
1. A variable name should be easy to read and convey the purpose of the variable. This helps when a number of variables are defined in a single transformation. 2. Variable names should follow the sentence case format i.e. the first letter of the name will be in upper case. 3. The use of an underscore is recommended as part of a variable name for clarity and readability. |
Example: The variable for first quarter sales should be named as Q1_sales instead of Q1sales.
Variable name | Variable Expression | Description |
v_Month | GET_DATE_PART( DATE_ENTERED, ’mm’) | Extract the Month from DATE_ENTERED |
v_Q1_sales | SUM(QUANTITY* PRICE-DISCOUNT, Month=1 or Month=2 or Month=3) | Calculate Q1 sales |
v_State_counter | IIF ( PREVIOUS_STATE= STATE, State_counter+1,1 ) | Increment v_State_counter if STATE in previous data record is same as current data record |
No comments:
Post a Comment