Ha360 - Sap Hana Hands-On Lab (Col08)

January 21, 2017 | Author: RepyRepy | Category: N/A
Share Embed Donate


Short Description

Ha360 - Sap Hana Hands-On Lab...

Description

Material number: 50125618 Collection 08

© SAP SE

HA360

1

© SAP SE

HA360

2

© SAP SE

HA360

3

© SAP SE

HA360

4

© SAP SE

HA360

5

© SAP SE

HA360

6

© SAP SE

HA360

7

© SAP SE

HA360

8

© SAP SE

HA360

9

© SAP SE

HA360

10

© SAP SE

HA360

11

© SAP SE

HA360

12

© SAP SE

HA360

13

© SAP SE

HA360

14

© SAP SE

HA360

15

© SAP SE

HA360

16

© SAP SE

HA360

17

© SAP SE

HA360

18

© SAP SE

HA360

19

© SAP SE

HA360

20

© SAP SE

HA360

21

© SAP SE

HA360

22

© SAP SE

HA360

23

© SAP SE

HA360

24

© SAP SE

HA360

25

© SAP SE

HA360

26

© SAP SE

HA360

27

© SAP SE

HA360

28

© SAP SE

HA360

29

© SAP SE

HA360

30

© SAP SE

HA360

31

© SAP SE

HA360

32

© SAP SE

HA360

33

© SAP SE

HA360

34

© SAP SE

HA360

35

© SAP SE

HA360

36

© SAP SE

HA360

37

© SAP SE

HA360

38

© SAP SE

HA360

39

© SAP SE

HA360

40

© SAP SE

HA360

41

© SAP SE

HA360

42

© SAP SE

HA360

43

© SAP SE

HA360

44

© SAP SE

HA360

45

© SAP SE

HA360

46

© SAP SE

HA360

47

© SAP SE

HA360

48

© SAP SE

HA360

49

© SAP SE

HA360

50

© SAP SE

HA360

51

© SAP SE

HA360

52

© SAP SE

HA360

53

© SAP SE

HA360

54

© SAP SE

HA360

55

© SAP SE

HA360

56

© SAP SE

HA360

57

© SAP SE

HA360

58

© SAP SE

HA360

59

© SAP SE

HA360

60

© SAP SE

HA360

61

© SAP SE

HA360

62

© SAP SE

HA360

63

© SAP SE

HA360

64

© SAP SE

HA360

65

© SAP SE

HA360

66

© SAP SE

HA360

67

© SAP SE

HA360

68

© SAP SE

HA360

69

© SAP SE

HA360

70

© SAP SE

HA360

71

© SAP SE

HA360

72

© SAP SE

HA360

73

© SAP SE

HA360

74

© SAP SE

HA360

75

© SAP SE

HA360

76

© SAP SE

HA360

77

© SAP SE

HA360

78

© SAP SE

HA360

79

© SAP SE

HA360

80

© SAP SE

HA360

81

© SAP SE

HA360

82

© SAP SE

HA360

83

© SAP SE

HA360

84

© SAP SE

HA360

85

© SAP SE

HA360

86

© SAP SE

HA360

87

© SAP SE

HA360

88

© SAP SE

HA360

89

© SAP SE

HA360

90

© SAP SE

HA360

91

© SAP SE

HA360

92

© SAP SE

HA360

93

© SAP SE

HA360

94

© SAP SE

HA360

95

© SAP SE

HA360

96

© SAP SE

HA360

97

© SAP SE

HA360

98

© SAP SE

HA360

99

© SAP SE

HA360

100

© SAP SE

HA360

101

© SAP SE

HA360

102

© SAP SE

HA360

103

© SAP SE

HA360

104

© SAP SE

HA360

105

© SAP SE

HA360

106

© SAP SE

HA360

107

© SAP SE

HA360

108

© SAP SE

HA360

109

© SAP SE

HA360

110

© SAP SE

HA360

111

© SAP SE

HA360

112

© SAP SE

HA360

113

© SAP SE

HA360

114

© SAP SE

HA360

115

© SAP SE

HA360

116

© SAP SE

HA360

117

© SAP SE

HA360

118

© SAP SE

HA360

119

© SAP SE

HA360

120

© SAP SE

HA360

121

© SAP SE

HA360

122

© SAP SE

HA360

123

© SAP SE

HA360

124

© SAP SE

HA360

125

© SAP SE

HA360

126

© SAP SE

HA360

127

© SAP SE

HA360

128

© SAP SE

HA360

129

© SAP SE

HA360

130

© SAP SE

HA360

131

© SAP SE

HA360

132

© SAP SE

HA360

133

© SAP SE

HA360

134

© SAP SE

HA360

135

© SAP SE

HA360

136

© SAP SE

HA360

137

© SAP SE

HA360

138

© SAP SE

HA360

139

© SAP SE

HA360

140

© SAP SE

HA360

141

© SAP SE

HA360

142

© SAP SE

HA360

143

© SAP SE

HA360

144

© SAP SE

HA360

145

© SAP SE

HA360

146

© SAP SE

HA360

147

© SAP SE

HA360

148

© SAP SE

HA360

149

© SAP SE

HA360

150

© SAP SE

HA360

151

© SAP SE

HA360

152

© SAP SE

HA360

153

© SAP SE

HA360

154

© SAP SE

HA360

155

© SAP SE

HA360

156

© SAP SE

HA360

157

© SAP SE

HA360

158

© SAP SE

HA360

159

© SAP SE

HA360

160

© SAP SE

HA360

161

© SAP SE

HA360

162

© SAP SE

HA360

163

© SAP SE

HA360

164

© SAP SE

HA360

165

© SAP SE

HA360

166

© SAP SE

HA360

167

© SAP SE

HA360

168

© SAP SE

HA360

169

© SAP SE

HA360

170

© SAP SE

HA360

171

© SAP SE

HA360

172

© SAP SE

HA360

173

© SAP SE

HA360

174

© SAP SE

HA360

175

© SAP SE

HA360

176

© SAP SE

HA360

177

© SAP SE

HA360

178

© SAP SE

HA360

179

© SAP SE

HA360

180

© SAP SE

HA360

181

© SAP SE

HA360

182

© SAP SE

HA360

183

© SAP SE

HA360

184

© SAP SE

HA360

185

© SAP SE

HA360

186

© SAP SE

HA360

187

© SAP SE

HA360

188

© SAP SE

HA360

189

© SAP SE

HA360

190

© SAP SE

HA360

191

© SAP SE

HA360

192

© SAP SE

HA360

193

© SAP SE

HA360

194

© SAP SE

HA360

195

© SAP SE

HA360

196

© SAP SE

HA360

197

© SAP SE

HA360

198

© SAP SE

HA360

199

© SAP SE

HA360

200

© SAP SE

HA360

201

Solutions Exercise 1 Unit: Advanced Modeling Lesson: Exercise 1

1-1

Create the Airports Attribute View 1-1-1

Right click over your package and select New –> Attribute View

1-1-2

Enter the name ATV_AIRPORTS_XX and click Finish

Page 1 of 90

1-1-3

Click on Data Foundation and add the following tables from Schema “FStats”: “Airports”, “Countries” and “States”

1-1-4

Add the following links: “FStats”.“Airports”.“State” –> “FStats”.“States”.“Code” (N…1 Left Outer) “FStats”.“Airports”.“Country” –> “FStats”.“Countries”.“Code” (N…1 Referential)

1-1-5

Add to output the following columns: “FStats”.“Airports”.“Code”, “FStats”.“Airports”.“Description”, “FStats”.“Airports”.“City”, “FStats”.“States”.“Description”, “FStats”.“Countries”.“Description”, “FStats”.“Airports”.“Latitude”, “FStats”.“Airports”.“Longitude” and “FStats”.“Airports”.“Size”

1-1-6

Select field “FStats”.“Airports”.“Code”, change the Name to AirportID and set the Property “Key Attribute” to True in the Properties Pane

1-1-7

Select field “FStats”.“Airports”.“Description” in the Output Pane and change the Attribute Name in the Properties Pane to “Airport”

Page 2 of 90

1-1-8

Rename “FStats”.“States”.“Description” to “State” and “FStats”.“Countries”.“Description” to “Country”. The Output Pane should look like this:

1-1-9

Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane

1-1-10 Click the Data Preview Button

Page 3 of 90

1-2

Create the On Time Analytic View 1-2-1 Right click over your package and select New –> Analytic View 1-2-2 Enter the name ANV_ONTIME_XX and click Finish

1-2-3

Click on Data Foundation and add Tables “FStats”.“On_Time” and “FStats”.“Airlines” and click Ok

1-2-4

Create the following link: “FStats”.“On_Time”.“AirlineID” –> “FStats”.“Airlines”.“Code” (N…1 Referential)

Page 4 of 90

1-2-5 Add the following fields to Output: “FStats”.“On_Time”.“Year” “FStats”.“On_Time”.“Quarter” “FStats”.“On_Time”.“Month” “FStats”.“On_Time”.“OriginAirportID” “FStats”.“Airlines”.“Description” “FStats”.“On_Time”.“DepDelay” “FStats”.“On_Time”.“Cancelled” 1-2-6 Click on Logical Join and rename “FStats”.“Airlines”.“Description” to “Airline” in the Properties Pane 1-2-7 Add Attribute View ATV_AIRPORTS_XX and create the following link: “Data Foundation”.“OriginAirportID” –> “ATV_AIRPORTS_XX”.“AirportID” (N…1 Referential)

1-2-8 Go to ”Semantics” 1-2-9 Mark the following columns as Attributes: “Year” “Quarter” “Month” “Airline”

Page 5 of 90

1-2-10 Mark the following columns as Measures: “DepDelay” “Cancelled”

1-2-11 Go back to “Logical Join” 1-2-12 Create a new Calculated Column and name it “Total_Departures” with Data Type Decimal (13,2) 1-2-13 In the Expression Editor enter the following text: "DepDelay" 1-2-14 Select Column Type “Measure”, check the “Calculate Before Aggregation” Option, select Aggregation Type COUNT and click OK

1-2-15 Create a new Calculated Column and Name it “Total_OnTime” with Data Type Decimal (13,2) 1-2-16 In the Expression Editor enter the following text: "DepDelay" 15 And "Cancelled" = 0 1-2-20 Select Column Type “Measure”, check the “Calculate Before Aggregation” Option and click OK 1-2-21 Create a new Calculated Column and Name it “Total_Cancelled” with Data Type Decimal (13,2) 1-2-22 In the Expression Editor enter the following text: "Cancelled" = 1 1-2-23 Select Column Type “Measure”, check the “Calculate Before Aggregation” Option and click OK 1-2-24 Create a new Calculated Column and Name it “Ontime_Performance” with Data Type Decimal (13,2) 1-2-25 In the Expression Editor enter the following text: "Total_OnTime" / "Total_Departures" 1-2-26 Select Column Type “Measure” and click OK 1-2-27 Create a new Calculated Column and Name it “Delayed_Performance” with Data Type Decimal (13,2) 1-2-28 In the Expression Editor enter the following text: "Total_Delayed" / "Total_Departures" 1-2-29 Select Column Type “Measure” and click OK

Page 7 of 90

1-2-30 Create a new Calculated Column and Name it “Cancelled_Performance” with Data Type Decimal (13,2) 1-2-31 In the Expression Editor enter the following text: "Total_Cancelled" / "Total_Departures" 1-2-32 Select Column Type “Measure” and click OK 1-2-33 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 1-2-34 Click the Data Preview Button

Page 8 of 90

Solutions Exercise 2 Unit: Advanced Modeling Lesson: Exercise 2

2-1

Create the Delay Groups Attribute View 2-1-1 Right click over your package and select New –> Attribute View 2-1-2 Enter the name ATV_DELAY_GROUPS_XX and click Finish

Page 9 of 90

2-1-3 Go to “Data Foundation” and add the following tables from Schema “FStats”: “FStats”.“Delay_Groups” and “FStats”.“Delay_Groups_Text” 2-1-4 Add the following fields to Output: “FStats”.“Delay_Groups”.”Code” “FStats”.“Delay_Groups_Text”.”Description” 2-1-5 Select column “Code” in the Output Pane and update property “Key Attribute” to True in the Properties Pane 2-1-6 Select column “Description” in the Output Pane and update property “Name” to “Delay_Group” 2-1-7 Create the following link: “FStats”.”Delay_Groups”.”Code” –> “FStats”.”Delay_Groups_Text”.”Code”

2-1-8 In the Properties Pane select “Join Type”: “Text Join” and in the Language Column drop down list select column “Language”

2-1-9 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 2-1-10 Click the Data Preview Button

Page 10 of 90

2-2

Create the Cost Analytic View 2-2-1 Right click over your package and select New –> Analytic View 2-2-2 Enter the name ANV_COST_XX and click Finish 2-2-3 Click on “Semantics” and select “ONE1” as the Default Schema

2-2-4 Click on “Data Foundation” and add table “FStats”.“Costs” 2-2-5 Add the following fields to output: “FStats”.“Costs”.“Year” “FStats”.“Costs”.“Quarter” “FStats”.“Costs”.“Month” “FStats”.“Costs”.“Fuel” “FStats”.“Costs”.“Crew” “FStats”.“Costs”.“Maintenance” “FStats”.“Costs”.“Aircraft_Ownership” “FStats”.“Costs”.“Other” “FStats”.“Costs”.“ConvDate” 2-2-6 Click on “Logical Join” 2-2-7 Right click over Input Parameters from Output Pane, and select New 2-2-8 Name it VCURRENCY 2-2-9 In the Semantic Type drop down list select Currency

Page 11 of 90

2-2-10 Set the Default Value to USD 2-2-11 In the Data Type drop down list select NVARCHAR and Length 5

2-2-12 Click OK 2-2-13 Create a new Calculated Column and Name it “TotalCost” 2-2-14 Specify Data Type DECIMAL (13,2) 2-2-15 Specify Column Type “Measure”

Page 12 of 90

2-2-16 In the Expression Editor enter the following text: "Maintenance" + "Other" + "Aircraft_Ownership" + "Fuel" + "Crew"

2-2-17 Click OK. 2-2-18 Select the TotalCost calculated column created recently from the Output panel, and open the Semantic Type pop up window from the Properties. 2-2-19 In the Semantic Type drop down list select Amount with Currency Code. 2-2-20 Check Enable for Conversion Option 2-2-21 Open the pop up window in the Source Currency field and select Fixed 2-2-22 Select “EUR” from the list and click OK

Page 13 of 90

2-2-23 Open the Target Currency Pop Up window and select Input Parameter

2-2-24 Select “VCURRENCY” and click OK

Page 14 of 90

2-2-25 Open the Exchange Type Pop Up window and select M

Page 15 of 90

2-2-26 Open the Conversion Date Pop Up window, select Column as the Type and “ConvDate” in the Columns tree

2-2-27 Open the Client for currency conversion Pop Up window, select Type Fixed/Session Client; Fixed Client 800 and uncheck Session Client; click Ok

Page 16 of 90

2-2-28 Click Ok

2-2-29 Click on “Semantics” and mark the following columns as attributes: “Year” “Quarter” “Month” “ConvDate” 2-2-30 Mark the following columns as Measures: “Fuel” “Crew” “Maintenance” “Aircraft_Ownership” “Other” 2-2-31 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 2-2-32 Click the Data Preview Button 2-2-33 A window like this should appear letting you pick the target currency

Page 17 of 90

2-3

Create the Delays Analytic View 2-3-1 Right click over your package and select New –> Analytic View 2-3-2 Enter the name ANV_DELAY_XX 2-3-3 Click on “Data Foundation” and add the following tables from the FStats schema: “FStats”.“On_Time” and “FStats”.“Airlines” 2-3-4 Create the following link: “FStats”.“On_Time”.“AirlineID” –> “FStats”.“Airlines”.“Code” (N…1 Referential) 2-3-5 Add the following fields to Output: “FStats”.“On_Time”.“Year” “FStats”.“On_Time”.“Quarter” “FStats”.“On_Time”.“Month” “FStats”.“Airlines”.“Description” “FStats”.“On_Time”.“OriginAirportID” “FStats”.“On_Time”.“DepartureDelayGroups” “FStats”.“On_Time”.“Cancelled” “FStats”.“On_Time”.“DepDelay” “FStats”.“On_Time”.“CarrierDelay” “FStats”.“On_Time”.“WeatherDelay” “FStats”.“On_Time”.“SecurityDelay” “FStats”.“On_Time”.“NASDelay” “FStats”.“On_Time”.“LateAircraftDelay” 2-3-6 Right click over “FStats”.“On_Time”.“DepDelay” and select Apply Filter. 2-3-7 In the Operator field select Greater than and in the Value field enter 15.

2-3-8 Click OK 2-3-9 Right click over “FStats”.“On_Time”.“Cancelled” and select Apply Filter.

Page 18 of 90

2-3-10 In the Operator field select “Equal” and in the Value field enter 0

2-3-11 Click OK. 2-3-12 Click on “Logical Join” 2-3-13 Rename the Attribute “FStats”.“Airlines”.“Description” to “Airline” in the Properties Pane 2-3-14 Add the following Attribute Views: “ATV_AIRPORTS_XX” “ATV_DELAY_GROUPS_XX” 2-3-15 Create the following links: “Data Foundation”.“OriginAirportID” –> “ATV_AIRPORTS_XX”.“AirportID” (N…1 Referential) “Data Foundation”.“DepartureDelayGroups” –> “ATV_DELAY_GROUPS_XX”.“Code” (N…1 Referential)

2-3-16 Click on “Semantics” and mark the following columns as Attributes: “Year” “Quarter” “Month” “Airline” 2-3-17 Mark the remaining columns as Measures 2-3-18 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 2-3-19 Click the Data Preview Button Page 19 of 90

2-4

Create the Delay Calculation View 2-4-1 Right click over your package and select New –> Calculation View 2-4-2 Enter the name CAV_DELAY_XX 2-4-3 Click Finish 2-4-4 From the Tools Pallet select Join 2-4-5 Drag the ANV_DELAY_XX and drop it in the Join_1 Scenario 2-4-6 Drag the ANV_COST_XX and drop it in the Join_1 Scenario

2-4-7 Click on Join_1 and create an Inner Join N…1 between the following fields: ANV_DELAY_XX.Year ANV_COST.Year ANV_DELAY_XX.Month ANV_COST.Month

Page 20 of 90

2-4-8 Add the following fields to Output: “ANV_DELAY_XX”.“Quarter” “ANV_DELAY_XX”.“Airline” “ANV_DELAY_XX”.“Delay_Group” “ANV_DELAY_XX”.“Airport” “ANV_DELAY_XX”.“City” “ANV_DELAY_XX”.“State” “ANV_DELAY_XX”.“Country” “ANV_DELAY_XX”.“DepDelay” “ANV_DELAY_XX”.“CarrierDelay” “ANV_DELAY_XX”.“WeatherDelay” “ANV_DELAY_XX”.“SecurityDelay” “ANV_DELAY_XX”.“NASDelay” “ANV_DELAY_XX”.“LateAircraftDelay” “ANV_COST_XX”.“TotalCost” “ANV_COST_XX”.“TotalCost_CURRENCY”

2-4-9 Right click over Input Parameter and select “Manage Mapings”

Page 21 of 90

2-4-10 Drag the “VCURRENCY” Input Parameter from the left pane and drop it into the right pane and click OK

2-4-11 Link Join_1 to Aggregation

2-4-12 Select Aggregation

Page 22 of 90

2-4-13 Select the following fields, right click and select “Add to Output” Year Month Quarter Airline Delay_Group Airport City State Country TotalCost_Currency

Page 23 of 90

2-4-14 Select the following fields, right click and select “Add as Aggregated Column” DepDelay CarrierDelay WeatherDelay NASDelay SecurityDelay LateAircraftDelay TotalCost

2-4-15 Create a new Calculated Column and Name it “TotalCost_Delay” 2-4-16 Select Data Type DECIMAL ( 13, 2 ) 2-4-17 Select Column Type: Measure 2-4-18 In the Expression Editor enter the following text: "DepDelay" * "TotalCost" 2-4-19 Click OK 2-4-20 Create a new Calculated Column and Name it “TotalCost_CarrierDelay” 2-4-21 Select Data Type DECIMAL ( 13, 2 ) 2-4-22 Select Column Type: Measure 2-4-23 In the Expression Editor enter the following text: "CarrierDelay" * "TotalCost" 2-4-24 Click OK 2-4-25 Go to the “Semantics” scenario

Page 24 of 90

2-4-26 Mark the following fields as Attribute: Year Quarter Month Country State City Airport Airline Delay_Group TotalCost_CURRENCY 2-4-27 Create a new variable

2-4-28 Name it VAR_Year 2-4-29 In the Attribute field select Year 2-4-30 In the Default Value enter 2012

Page 25 of 90

2-4-31 Click OK

2-4-32 Create a new variable 2-4-33 Name it VAR_Month 2-4-34 In the Attribute field select Month 2-4-35 In the Default Value enter 3 2-4-36 Click OK 2-4-37 Create a new variable 2-4-38 Name it VAR_Airline 2-4-39 In the Attribute field select Airline

Page 26 of 90

2-4-40 In the Default Value enter American Airlines Inc. 2-4-41 Click OK 2-4-42 Create a new variable 2-4-43 Name it VAR_Airport 2-4-44 In the Attribute field select Airport 2-4-45 In the Default Value enter John F. Kennedy International 2-4-46 Click OK 2-4-47 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 2-4-48 Click the Data Preview Button 2-4-49 A window like this should appear letting you pick the target currency and the filter values for the variables

Page 27 of 90

Page 28 of 90

Solutions Exercise 3 Unit: Fuzzy Search Lesson: Exercise 3

3-1

Create a new scripted Calculation View that queries the Analytic View created in Exercise 1 (ANV_ONTIME_XX) 3-1-1 Right click over your package and select New –> Calculation View 3-1-2 Enter the Name CAV_ONTIME_FUZZY_XX 3-1-3 In the Subtype select SQL Script 3-1-4 Click Finish 3-1-5 Click on Script_View in the Scenario Pane 3-1-6 Right click over Input Parameters and select New 3-1-7 Name it IN_Year

Page 29 of 90

3-1-8 Select SmallInt from the Data Type drop down list and click OK

3-1-9 Create another Input Parameter, name it IN_Month, select TinyInt as the Data Type and click OK

Page 30 of 90

3-1-10 Create a new Input Parameter, name it IN_Airport, select NVarChar as the Data Type, Length 100 and click OK 3-1-11 Right click over Columns in the Output Pane and select Create Target 3-1-12 Define the Output with the following structure:

3-1-13 Click OK 3-1-14 Enter the following text in the Script View Pane: var_out = Select "Year", "Month", "Airport", "Airline", Sum("Ontime_Performance") As "Ontime_Performance" From "_SYS_BIC"."stXX/ANV_ONTIME_XX" Where CONTAINS( "Airport", :IN_Airport, FUZZY( 0.8, 'textSearch=compare' ) ) And "Year" = :IN_Year And "Month" = :IN_Month Group By "Year", "Month", "Airport", "Airline";

3-1-15 Click on Semantics in the Scenario Pane 3-1-16 Mark the following columns as Attributes: Year Month Airport Airline 3-1-17 Mark the following column as Measure: Ontime_Performance 3-1-18 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 3-1-19 Click on Data Preview and use the following values for the Input Parameters: IN_Year = 2012 IN_Month = 3 IN_Airport = kenedy

Page 31 of 90

3-2

On the same scripted calculation view created on the prior step (CAV_ONTIME_FUZZY_XX) modify the script to implement the Term Mappings Option to enable the user to use the Airport Abbreviation 3-2-1 Open a new SQL Editor 3-2-2 Execute the following script: CREATE COLUMN TABLE "STXX"."TermMappings" LIKE "FStats"."TermMappings" WITH DATA;

3-2-3 Open the Scripted Calculation View created in the prior exercise (CAV_ONTIME_FUZZY_XX) 3-2-4 Click on Script in the Scenario Pane and replace the existing script with the following text: var_out = Select "Year", "Month", "Airport", "Airline", Sum("Ontime_Performance") As "Ontime_Performance" From "_SYS_BIC"."stXX/ANV_ONTIME_XX" Where CONTAINS( "Airport", :IN_Airport, FUZZY( 0.8, 'textSearch=compare, termMappingTable="STXX"."TermMappings", termMappingListId=01' ) ) And "Year" = :IN_Year And "Month" = :IN_Month Group By "Year", "Month", "Airport", "Airline";

3-2-5 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 3-2-6 Click on Data Preview and use the following values for the Input Parameters: IN_Year = 2012 IN_Month = 3 IN_Airport = JFK

Page 32 of 90

Solutions Exercise 4 Unit: CE Plan Operators Lesson: Exercise 4

4-1

Create a new Scripted Calculation View 4-1-1 Right click over your package and select New –> Calculation View 4-1-2 Enter the name CAV_DELAY_CE_XX 4-1-3 In Subtype select SQL Script 4-1-4 Click Finish 4-1-5 Select Script_View in the Scenario Pane 4-1-6 Right click over Input Parameters and select new

Page 33 of 90

4-1-7 Specify IN_Year as the Name and SmallInt as the Data Type

4-1-8 Click OK 4-1-9 Right click over Input Parameters and select new

Page 34 of 90

4-1-10 Specify IN_Month as the Name and TinyInt as the Data Type 4-1-11 Click OK 4-1-12 Right click over Input Parameters and select new 4-1-13 Specify IN_Airline as the Name and NVarChar(100) as the Data Type 4-1-14 Click OK 4-1-15 Right click over Input Parameters and select new 4-1-16 Specify IN_Airport as the Name and NVarChar(100) as the Data Type 4-1-17 Click OK 4-1-18 Right click over Columns and select Create Target 4-1-19 Define the Output like this:

4-1-20 Click OK

Page 35 of 90

4-1-21 In the Details of Script_View Pane enter the following text: AnCost = CE_OLAP_VIEW( "_SYS_BIC"."stXX/ANV_COST_XX", ["Year", "Month", "TotalCost"] ); AnDelay = CE_OLAP_VIEW( "_SYS_BIC"."stXX/ANV_DELAY_XX", ["Year", "Month", "Airport", "Airline", "Delay_Group", "DepDelay", "CarrierDelay"] ); Join1 = CE_JOIN( :AnCost, :AnDelay, [ "Year", "Month" ], [ "Year", "Month", "Airport", "Airline", "Delay_Group", "TotalCost", "DepDelay", "CarrierDelay"] ); var_out = CE_PROJECTION( :Join1, [ "Year", "Month", "Airport", "Airline", "Delay_Group", "DepDelay", "CarrierDelay", "TotalCost", CE_CALC( '"TotalCost" * "DepDelay"', Decimal(13,2)) AS "TotalCost_Delay", CE_CALC( '"TotalCost" * "CarrierDelay"', Decimal(13,2)) AS "TotalCost_CarrierDelay" ], '"Year" = :IN_Year AND "Month" = :IN_Month AND "Airline" = '':IN_Airline'' AND "Airport" = '':IN_Airport''');

4-1-22 Select Semantics in the Scenario Pane 4-1-23 Mark the following fields as Attribute: Year Month Airport Airline Delay_Group 4-1-24 Add the following fields as Measure: DepDelay CarrierDelay TotalCost TotalCost_Delay TotalCost_CarrierDelay 4-1-25 Click the Save and Activate Button and make sure there are no error messages in the Job Log Pane 4-1-26 Click the Data Preview Button

Page 36 of 90

4-2

Debugging Procedures 4-2-1 Expand the _SYS_BIC schema under the Catalog folder in the Systems View

4-2-2 Expand the Procedures folder 4-2-3 Double click on the procedure “stXX/CAV_DELAY_CE_XX/proc” 4-2-4 Add checkpoints in lines: 5, 7, 9, 11 and 13

Page 37 of 90

4-2-5 Open the Debug Perspective

4-2-6 On the Debug button, select “Debug Configurations”. Alternatively, you can select the Debug Configurations option in the Run Menu

4-2-7 Select SAP HANA Stored Procedure and click on the “New Launch Configuration” button

4-2-8 In the General tab, select “Catalog Schema” in the Procedure to Debug field

4-2-9 Click on the Browse button and select the stXX/CAV_DELAY_CE_XX/proc procedure under the Procedures folder in the _SYS_BIC schema. Then click Ok

Page 38 of 90

4-2-10 Navigate to the Input Parameters Tab 4-2-11 Specify the following values for each of the Input Parameters: IN_YEAR = 2012 IN_MONTH = 3 IN_AIRLINE = American Airlines Inc. IN_AIRPORT = John F. Kennedy International

4-2-12 Click on Apply at the bottom of the screen 4-2-13 Click on Debug 4-2-14 The debugger will stop in the first breakpoint in line 5

4-2-15 Resume the debugging session to the next breakpoint by pressing F8 or the Resume button

Page 39 of 90

4-2-16 Right click over any table variable in the Variables view and select “Open Data Preview”

4-2-17 Resume the debugging session by pressing F8 or clicking on the Resume button

Page 40 of 90

Solutions Exercise 5 Unit: Best Practices When Using SQLScript Lesson: Exercise 5

5-1

Visualize the Execution Plan for ANV_ONTIME_XX 5-1-1 Open the ANV_ONTIME_XX Analytic View 5-1-2 Click on the Data Preview button and select “Open in SQL Editor”

5-1-3 In the SQL Editor, open the SQL Tab. 5-1-4 Highlight the query, right click and select “Visualize Plan”

5-1-5 Click “Yes” on the Confirm Perspective Switch window to open the Plan Viz perspective

Page 41 of 90

5-1-6 Right click in the blank area and select Execute

5-1-7 Expand the tree in the Timeline pane to show the longest running node (BwPopAggregateParallel node)

5-1-8 Repeat the steps for the ANV_PE Analytic View and compare the execution plan for both views

Page 42 of 90

Solutions Exercise 6 Unit: SAP HANA Development Lesson: Exercise 6

6-1

Create a Repository Workspace and a Project 6-1-1 Open the SAP HANA Development perspective by going to the main menu Window -> Open Perspective -> Other -> SAP HANA Development 6-1-2 Go to the SAP HANA Repositories Tab 6-1-3 Right click in the blank area and select “Create Repository Workspace” 6-1-4 Select the HANA HOST from the SAP HANA Systems List, uncheck the option Use Default Workspace, enter the name DevWSXX in the Workspace Name Field and C:\Users\student\Documents\repo as the Workspace Root (if the repo folder does not exist, you can create it by clicking in the Browse button)

6-1-5 Navigate to the Project Explorer Tab 6-1-6 Right click in the blank area and select New -> Project Page 43 of 90

6-1-7 Select XS Project under the SAP HANA -> Application Development folder and click next

Page 44 of 90

6-1-8 Enter projectXX as the Project Name and click Next.

Page 45 of 90

6-1-9 Select your package (stXX) by clicking the Browse button and uncheck the Add Project Folder as Subpackage checkbox. Then click on Finish

Page 46 of 90

6-1-10 Right click over the root node of your project and select Team –> Check Out

6-1-11 Now you should see all the views and procedures that you built during the training inside your project 6-1-12 Right click over the root node of your project and select Team –> Activate

Page 47 of 90

6-2

Train a Decision Tree with the Application Function Modeler 6-2-1

Open the SAP HANA Development Perspective

6-2-2 Right click on the root node of your project and select New HANA Database Development AFL Model

Other

SAP

6-2-3 Click on Next

Page 48 of 90

6-2-4 Specify the name DT_Train_XX and click on Finish

6-2-5 You should now see a new file in your project called DT_Train_XX.aflpmml

6-2-6 Double click in the newly created file to open the AFM.

Page 49 of 90

6-2-7 From the PAL section, expand “Classification”, and drag in the “C4.5 – createDT” function

6-2-8 Click on the Expand button

Page 50 of 90

6-2-9 Drag in the FStats.TRAINDT Table left to the Training box

6-2-10 Create a connection between TRAINDT and Training

6-2-11 Drag in the FStats.JSONMODEL into the JsonModel box

6-2-12 Drag in the FStats.PMMLMODEL Table into the PMMLModel box

Page 51 of 90

6-2-13 Right click on the blank area of the model and select “View Properties”

6-2-14 Specify DT_TRAIN_XX as the Procedure Name and select your schema (STXX) in the Procedure Schema Drop Down box

6-2-15 Click on the Save Button 6-2-16 In the Project Explorer tab, right click over the DT_TRAIN_XX.aflpmml file and select Team Activate 6-2-17 In the AFM click on the Call button

Page 52 of 90

6-2-18 Navigate to the SAP HANA Systems Tab and expand the Procedures and Tables folders in your schema, you should see the tables and procedures that were created with the execution of the predictive model

6-2-19 Right click over the "STXX"."stXX::DT_Train_XX.DT_TRAIN_XX_createDT_JsonModel" table and make sure the table has been populated with the Json model of the Decision Tree 6-3

Predicting Flight Delays with Decision Trees 6-3-1 Go back to the Project Explorer Tab and create a new Predictive Model file by right clicking in the root node of your project and select New Other SAP HANA Database Development AFL Model 6-3-2 Specify Name DT_Predict_XX and click on finish 6-3-3 Double click on the newly created file to open the modeler 6-3-4 Drag in the “Predict with Decision Tree” function from PAL Classification and click on the Expand button

Page 53 of 90

6-3-5 Drag in the FStats.PREDICT_WITH_DT Table and place it left to the Predict Box 6-3-6 Create a link between the PREDICT_WITH_DT Table and the Predict box

6-3-7 Drag in the "STXX"."stXX::DT_Train_XX.DT_TRAIN_XX_createDT_JsonModel" Table from your schema and place it left to the Model box 6-3-8 Create a link between the "STXX"."stxx::DT_Train_XX.DT_TRAIN_XX_CREATEDT_JSONMOD EL" and the Model box

6-3-9 Drag in the FStats.RESULT_DT and drop it in the Result box

Page 54 of 90

6-3-10 Right click on the blank area of the modeler and select “View Properties” 6-3-11 Specify DT_PREDICT_XX as the Procedure Name and your schema (STXX) as the Procedure Schema

6-3-12 Click on the Save button 6-3-13 In the Project Explorer tab, right click over the DT_PREDICT_XX.aflpmml file and select Team Activate 6-3-14 In the AFM click on the Call button 6-3-15 Navigate to the SAP HANA Systems tab, right click over the Tables folder and select Refresh 6-3-16 Do a Data Preview of the "STXX"."stXX::DT_Predict_XX.DT_PREDICT_XX_predictWithDT_R esult" Table and take a look at the results: If you fly with American Airlines on a Friday from Chicago to New York between 4pm and 4:59pm most likely your flight will be Delayed But if you fly in the same timeframe with American Eagle most likely your flight will not be Delayed If you fly with American Airlines on a Friday from Chicago to New York between 5pm and 5:59pm most likely your flight will not be Delayed

Page 55 of 90

Page 56 of 90

Solutions Exercise 7

7-1

Unit:

Visualizing Data with SAP Lumira

Lesson:

Exercise 7

Visualizing Data with SAP Lumira 7-1-1 Open SAP Lumira 7-1-2 Click on the cube

7-1-3 Select “Download from SAP HANA” and click Next 7-1-4 Provide the following credentials: Server: imdbhdbcc2 Instance: 00 User: SYSTEM Password: manager 7-1-5 Click on Connect 7-1-6 Select the ANV_ONTIME_XX Analytic View under your package and click on Create 7-1-7 In the Dimensions Pane click on the arrowhead next to the Airport Description column and select Create a Geographic Hierarchy By Latitude and Longitude

Page 57 of 90

7-1-8 Specify the Latitude and Longitude columns in the corresponding fields

7-1-9 Click Next and then Finish

Page 58 of 90

7-1-10 Change the Chart Type to Geo Bubble Chart

7-1-11 Click on the + button next to the Value field and select Total_Delayed

7-1-12 Click on the + button next to the Geography field and select Airport Description

7-1-13 Click on + button left next to the View icon to create a new view on the same document

Page 59 of 90

7-1-14 Change the Chart Type to Table

7-1-15 Click on the + button right next to the Primary Values field and select Total_Delayed

7-1-16 Click on the arrowhead in Total_Delayed and select Rank Values

Page 60 of 90

7-1-17 Specify Top 5 in the Ranking window and click Ok

7-1-18 Click on the arrowhead right next to the Row Axis field and select Airport Description

7-1-19 Click on + button left next to the View icon to create a new view on the same document

Page 61 of 90

7-1-20 Change the Chart Type to Stacked Column Chart

7-1-21 Add Total_Cancelled, Total_Delayed and Total_OnTime to the Y Axis

7-1-22 Add Year to the X Axis

Page 62 of 90

7-1-23 Navigate to the Compose View

7-1-24 Select and create the Story with layout for the charts

7-1-25 Drag the charts from the left and drop them in the Dashboard designer

Page 63 of 90

7-1-26 Drag the Airline Description Input Control from the left pane and drop it in the Dashboard designer to filter data accordingly to the selection

7-1-27 Change the name from Board Title to Departure Delays 7-1-28 Click on the Preview button to preview the Story

Page 64 of 90

Solutions Additional Exercise 1 Unit: Additional Exercises Lesson: Additional Exercise 1

1-1

Make a copy of the TWITTER Table and enable Text Analysis 1-1-1 Open a new SQL Editor Window 1-1-2 Execute the following statement to make a copy of the TWITTER table in your own schema: CREATE COLUMN TABLE STXX.TWITTER_XX LIKE "FStats"."TWITTER" WITH DATA;

1-1-3 Enable Text Analysis by executing the following statement: CREATE FULLTEXT INDEX "FT_TWEETS" ON "STXX"."TWITTER_XX" ("TEXT") FUZZY SEARCH INDEX ON TEXT ANALYSIS ON CONFIGURATION 'EXTRACTION_CORE_VOICEOFCUSTOMER';

Page 65 of 90

Page 66 of 90

Solutions Additional Exercise 2 Unit: Additional Exercises Lesson: Additional Exercise 2

2-1

Build the SQL View 2-1-1 Create the SQL View by executing the following statement: CREATE VIEW STXX.SA_XX AS ( SELECT A.ID, B.TA_TOKEN, B.TA_TYPE, C."Description" AS STATE FROM "ST01"."TWITTER_01" AS A INNER JOIN "ST01"."$TA_FT_TWEETS" AS B ON A.ID = B.ID CROSS JOIN "FStats"."States" AS C WHERE A.LOCATION.ST_Within( C.SHAPE ) = 1);

Page 67 of 90

Page 68 of 90

Solutions Additional Exercise 3 Unit: Additional Exercises Lesson: Additional Exercise 3

3-1

Create a Sentiment Analysis Dashboard with SAP Lumira 3-1-1 Open SAP Lumira 3-1-2 Click on the cube

3-1-3 Select Query With SQL and click on Next

Page 69 of 90

3-1-4 Select SAP HANA database 1.0 – JDBC Drivers and click on Next

3-1-5 Provide the following credentials: User Name: SYSTEM Password: manager Data Source Format: Single Server Host Name: imdbhdbcc2 Instance Number: 00 3-1-6 Click on Connect

Page 70 of 90

3-1-7 Type in the following statement in the Query field and then click on Preview: SELECT * FROM STXX.SA_XX

Page 71 of 90

3-1-8 Click on Create 3-1-9 Click on the arrowhead right next to the TA_TYPE column in the Attributes pane and select Filter

Page 72 of 90

3-1-10 Type sentiment in the search field

3-1-11 Select NeutralSentiment, StrongNegativeSentiment, StrongPositiveSentiment, WeakNegativeSentiment and WeakPositiveSentiment

3-1-12 Click Ok

Page 73 of 90

3-1-13 Click on the arrowhead next to the STATE column in the Attributes pane and select Create a Geographic Hierarchy By Names

3-1-14 Ensure STATE Dimension as Region, click Ok and the click Done.

Page 74 of 90

3-1-15 Click on the arrowhead next to the ID column in the Measures pane and select Change Aggregation Count (distinct)

3-1-16 Change the Chart Type to Geo Pie Chart

Page 75 of 90

3-1-17 Click on the + button next to Value and select ID

3-1-18 Click on the + button next to the Geography field and select Region

Page 76 of 90

3-1-19 Click on the + button next to the Overlay Data field and select TA_TYPE

3-1-20 Click on + to create a new visualization 3-1-21 Change the Chart Type to Tree Map

3-1-22 Click on the + button next to Area Weight and select ID

Page 77 of 90

3-1-23 Click on the + button next to Area Name and select TA_TYPE

3-1-24 Click on + to create a new visualization 3-1-25 Change the Chart Type to Tag Cloud

3-1-26 Click on the + button next to the Word Weight field and select ID

Page 78 of 90

3-1-27 Click on the + button next to the Word field and select TA_TOKEN

3-1-28 Switch to the Compose View 3-1-29 Select and create the Story with layout for the charts

Page 79 of 90

3-1-30 Drag the charts from the left and drop them in the Dashboard designer

3-1-31 Drag the STATE Input Control from the left pane and drop it in the Dashboard designer to filter data accordingly to the selection

3-1-32 Change the name from Board Title to Sentiment Analysis

Page 80 of 90

Solutions Additional Exercise 4 Unit: Additional Exercises Lesson: Additional Exercise 4

4-1

Create a new Analytic View 4-1-1 Right click on your package and select New -> Analytic View 4-1-2 Name it ANV_PAX_XX and click Finish 4-1-3 Go to the Data Foundation scenario and add tables “FStats”.“Stats” and “FStats”.“Airlines” 4-1-4 Create a join between the Stats table and the Airlines one “FStats”.“Stats”.“AirlineID” “FStats”.“Airlines”.“Code” (n…1 Referential) 4-1-5 Add the following columns to Output “FStats”.“Stats”.“Year” “FStats”.“Stats”.“Quarter” “FStats”.“Stats”.“Month” “FStats”.“Stats”.“OriginAirportID” “FStats”.“Stats”.“Passengers” “FStats”.“Airlines”.“Description” 4-1-6 Go to the Logical Join scenario 4-1-7 Add the Airports Attribute View (ATV_AIRPORTS_XX) 4-1-8 Create a join between the Data Foundation and the Airports Attribute View “Data Foundation”.“OriginAirportID” “ATV_AIRPORTS_XX”.“AirportID” (n…1 Referential) 4-1-9 Go to the Semantics scenario

Page 81 of 90

4-1-10 Rename column “Description” to “Airline” 4-1-11 Mark the following columns as attributes: Year Quarter Month Airline 4-1-12 Mark the Passengers column as Measure 4-1-13 Save and Activate 4-1-14 Click on Data Preview to make sure the data is being displayed correctly

Page 82 of 90

4-2

Create a new Calculation View 4-2-1 Right click over your package and select New -> Calculation View 4-2-2 Name it CAV_PAX_XX and click on Finish 4-2-3 Add a Union from the Tools Palette and place it below the Aggregation

4-2-4 Add ANV_PAX_XX and ANV_ONTIME_XX to Union_1

Page 83 of 90

4-2-5 Drag all the columns from ANV_PAX_XX to the Target(s) section

4-2-6 Map the corresponding columns from ANV_ONTIME_XX to the Target

Page 84 of 90

4-2-7 Add Measures “Total_Delayed” and “Delayed_Performance” from ANV_ONTIME_XX to the Target

4-2-8 Add a Projection from the Tools Palette and place it between Union_1 and Aggregation

Page 85 of 90

4-2-9 Add an Aggregation and place it between Union_1 and Projection_1

4-2-10 Create a link between Union_1 and Aggregation_1, another one between Aggregation_1 and Projection_1 and another one between Projection_1 and Aggregation

Page 86 of 90

4-2-11 Go to the Aggregation_1 scenario 4-2-12 Add the following columns to Output: Year Quarter Month Airline AirportID Airport City State Country Latitude Longitude Size

Page 87 of 90

4-2-13 Add the three remaining columns as Aggregated Column

4-2-14 Go to the Projection_1 scenario 4-2-15 Add all the columns to Output 4-2-16 Right clicking over the Calculated Columns folder in the Output pane and select New Calculated Column 4-2-17 Name it Affected_Pax and specify Data Type DECIMAL (13, 2) 4-2-18 Add the following formula in the Expression Editor: "Passengers" * "Delayed_Performance"

4-2-19 Click Ok 4-2-20 Right click over Expression under the Filter folder in the Output pane and select Open

Page 88 of 90

4-2-21 Add the following filter in the Expression Editor: not isNull("Delayed_Performance") 4-2-22 Click Ok 4-2-23 Go to the Aggregation scenario 4-2-24 Add the following columns to Output: Year Quarter Month Airline AirportID Airport City State Country Latitude Longitude Size

Page 89 of 90

4-2-25 Add the remaining columns as Aggregated Column

4-2-26 Go to the Semantics scenario 4-2-27 Mark the following columns as Attribute: Year Quarter Month Airline AirportID Airport City State Country Latitude Longitude Size 4-2-28 Save and Activate 4-2-29 Click on Data Preview 4-2-30 Apply the following filters and compare to the Functional Design to make sure the data is tying out: Year = 2012 Month = 3 Airport = John F. Kennedy International

Page 90 of 90

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF