You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/synapse-analytics/sql/tutorial-data-analyst.md
+35-26Lines changed: 35 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,41 +135,50 @@ From the plot chart, you can see there's a weekly pattern, with Saturdays as the
135
135
Next, let's see if the drop in rides correlates with public holidays. We can see if there is a correlation by joining the NYC Taxi rides dataset with the Public Holidays dataset:
136
136
137
137
```sql
138
-
WITH taxi_rides AS
139
-
(
140
-
SELECT
141
-
CAST([tpepPickupDateTime] ASDATE) AS [current_day],
WHERE countryorregion ='United States'AND YEAR(date) =2016
160
+
),
161
+
joined_data AS (
163
162
SELECT
164
-
*
163
+
*
165
164
FROM taxi_rides t
166
165
LEFT OUTER JOIN public_holidays p ont.current_day=p.date
166
+
)
167
+
168
+
SELECT
169
+
*,
170
+
holiday_rides =
171
+
CASE
172
+
WHEN holiday is null THEN 0
173
+
WHEN holiday is not null THEN rides_per_day
174
+
END
175
+
FROM joined_data
167
176
ORDER BY current_day ASC
168
177
```
169
178
170
179

171
180
172
-
This time, we want to highlight the number of taxi rides during public holidays. For that purpose, we choose **none** for the **Category** column and **rides_per_day** and **holiday** as the **Legend (series)** columns.
181
+
This time, we want to highlight the number of taxi rides during public holidays. For that purpose, we choose **current_day** for the **Category** column and **rides_per_day** and **holiday_rides** as the **Legend (series)** columns.
173
182
174
183

0 commit comments