Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this article

...

A typical use of this Snap is categorizing table data, and calculating the performance of sales professionals. 

...

Image Added

Prerequisites

None.

Limitation

...

Input/OutputType of ViewNumber of ViewsExamples of Upstream and Downstream SnapsDescription
Input 

Document

  • Min: 1
  • Max: 1
  • ELT Transform
  • ELT Select
  • ELT Copy
  • ELT Filter
The SQL query in which you want to add the PIVOT function. Typically, it would be a SELECT query reading the source table. 
Output

Document

  • Min: 1
  • Max: 1
  • ELT Insert-Select
  • ELT Transform
  • ELT Unique

The incoming SQL query with the PIVOT function.

Snap Settings

Info
titleSQL Functions and Expressions for ELT

You can use the SQL Expressions and Functions supported for ELT to define your Snap or Account settings with the Expression symbol = enabled, where available. This list is common to all target CDWs supported. You can also use other expressions/functions that your target CDW supports.

...

We want to analyze the sales made by two agents in a company. We can construct a query that reads the source table, filters the sales records of these two agents using a WHERE clause, and then add aggregate functions grouped by the agent's identifier. However, this approach only provides us with the aggregated score without further details.
In a sales environment, we typically need additional details such as dates of sale, products sold, and a number of orders. This Pipeline shows how we can use the ELT Pivot Snap to accomplish this task.

Image Modified

First, we build a SELECT query to read the target table. To do so, we use the ELT Select Snap. Sales data is maintained in the table ORDERS3. We configure the ELT Select Snap to read this table. Additionally, we also configure the Snap to show a preview of the SELECT query's execution:

A preview of the output from the ELT Select Snap is shown below:

Image Modified

We want to calculate the total sales made by the agents, A002, and A010, on each day. Therefore, we use the ELT Pivot Snap and configure it as shown below:

Image RemovedImage Added

This Snap builds the following query based on this configuration:

Image Modified

A tabular representation of this output is as shown below:

Image Modified

The days on which the agents did not make any sales are automatically assigned a null value. We can use an ELT Insert-Select Snap to write the query's output into another table. Additionally, we can use a combination of the ELT Copy and ELT Filter Snaps to write each of the agent's performances into separate tables. 

...