QuestionQ11

VerifiedImplement and manage an analytics solution

You have a Fabric eventhouse containing a KQL database. The database includes a table named TaxiData. The following shows a sample of the data in TaxiData.

Question Image

You need to create two KQL queries. The solution must satisfy these requirements:

  • One query must partition RunningTotalAmount by VendorID.
  • The other query must create a FirstPickupDateTime column that displays the first value of each hour from tpep_pickup_datetime, partitioned by payment_type.

How should each query be completed? Each value can be used once, multiple times, or not at all.

Drag & Drop
Statement1:
TaxiData
| sort by VendorID asc
| extend RunningTotalAmount = (total_amount, VendorID != prev(VendorID))

Statement2:
TaxiData
| sort by tpep_pickup_datetime asc, payment_type asc
| extend FirstPickupDateTime = (tpep_pickup_datetime, 1h, 0m, payment_type != prev(payment_type))
Explanation

row_cumsum produces a cumulative total and restarts when its restart predicate is true, so the change in VendorID begins a new running total. row_window_session returns the first datetime of each window/session; its one-hour setting and restart condition create the first pickup datetime for each payment_type partition. The rank functions return ordinal rankings rather than either required value.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!