Date: Fri, 7 Oct 2022 21:41:18 +0000 (UTC) Message-ID: <191665593.8899.1665178878141@93e1396c9615> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8898_1811369262.1665178878141" ------=_Part_8898_1811369262.1665178878141 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html EXAMPLE - Comparison Functions2

# EXAMPLE - Comparison Functions2

In the town of Circleville= , citizens are allowed to maintain a single crop circle in their backyard, = as long as it confirms to the town regulations. Below is some data on the s= ize of crop circles in town, with a separate entry for each home. Limits ar= e displayed in the adjacent columns, with the `inclusive`= columns indicating whether the minimum or maximum values are inclusive.

Tip: As part of this exercise, you can see how to you c= an extend your recipe to perform some simple financial analysis of the data= .

Source:

House1 55.5 10 Y 25 N
House2 12 10 Y 25 N
House3 14.25 10 Y 25 N
House4 3.5 10 Y 25 N
House5 27 10 Y 25 N

Transform:

After the data is loaded into the Transformer page, you can begin compar= ing column values:

While accurate, the a= bove transform does not account for the `minInclusive` valu= e, which may be changed as part of your steps. Instead, you can delete= the previous transform and use the following, which factors in the other c= olumn:=20
In this c= ase, the `IF` function tests whether the minimum value is i= nclusive (values of `10` are allowed). If so, the ```LES= STHANEQUAL``` function is applied. Otherwise, the ```LESSTHAN function is applied. For the maximum limit, the following step applie= s:=20 derive type:single value: IF(= maxInclusive =3D=3D 'Y',GREATERTHANEQUAL(Radius_ft,maxRadius_f= t),GREATERTHAN(Radius_ft,maxRadius_ft)) as:'tooBig' Now, = you can do some analysis of this data. First, you can insert a column conta= ining the amount of the fine per foot above the maximum or below the minimu= m. Before the first derive command, insert the following,= which is the fine (\$15.00) for each foot above or below the l= imits:=20 derive type:single value: 15 as:'fi= neDollarsPerFt' At the end of the recipe, add the following new = line, which calculates the fine for crop circles that are too small:=20 derive type:single value: IF(tooSma= ll =3D=3D 'true', (minRadius_ft - Radius_ft) * fineDollarsPerF= t, 0.0) as: 'fine_Dollars' The above captures the too-small viol= ations. To also capture the too-big violations, change the above to the fol= lowing:=20 derive type:single value: IF(= tooSmall =3D=3D 'true', (minRadius_ft - Radius_ft) * fineDollarsPerFt, if(t= ooBig =3D=3D 'true', (Radius_ft - maxRadius_ft) * fineDollarsPerFt, '0.0')) as: 'fine_Dollars' In place of the orig= inal "false" expression (0.0), the above adds the test for the= too-big values, so that all fines are included in a single column. You can= reformat the fine_Dollars column to be in dollar format:=20 set col: fine_Dollars value: NUMFORMAT(fine_Doll= ars, '\$###.00')   Results: After you drop the columns used in the calculation and move the remainin= g ones, you should end up with a dataset similar to the following: Location fineDollarsPerFt Radius_ft minRadius_ft minInclusive maxRadius_ft maxInclusive fineDollars House1 15 55.5 10 Y 25 N \$457.50 House2 15 12 10 Y 25 N \$0.00 House3 15 14.25 10 Y 25 N \$0.00 House4 15 3.5 10 Y 25 N \$97.50 House5 15 27 10 Y 25 N \$30.00 Now that you have created all of the computations for generating t= hese values, you can change values for minRadius_ft, maxRadius_ft, and fineDollarsPer= Ft to analyze the resulting fine revenue. Before or after the = transform where you set the value for fineDollarsPerFt, y= ou can insert something like the following: set col: minRadius_ft value:'12.5' After the step is added, select the last line in the recipe. Then, you = can see how the values in the fineDollars column have bee= n updated. ```
``` ------=_Part_8898_1811369262.1665178878141-- ```