1. Learn
  2. /
  3. Courses
  4. /
  5. Window Functions in Snowflake

Connected

Exercise

Visualizing charging session duration and cost

Your data visualization team wants to slice-and-dice the charging data in a bit of a different way. They'd like to better understand the duration of each charge at a charging station location on a certain day. They'd also like to compare the cost of each charging session to the average charging cost for that charging station location. Your job is to prepare a dataset for them to visualize this information!

Instructions

100 XP
  • Use a window function to find the proportion of total charging_duration for every session at each charging_station_location.
  • Find the difference between each session's charging cost and the average charging_cost for that charging_station_location; alias the results as cost_vs_avg.
  • Order the results by the charging_station_location and charging_date.
Powered by Snowflake