Create a computed column from a cross-tabulated column

Once you have a completed cross tabulation, you can work with the resultant columns of the new worksheet the same as you would with any other 1010data table. This makes it easy to create new metrics based on your summaries.

In this tutorial, you will perform a simple day-over-day calculation by first creating a cross tabulation and then creating a computed column.

In your analysis, you want to see the sales of one date compared to the sales of a different date for all three of your fictional stores. For this example, the dates are consecutive.

To create a computed column from a cross-tabulated column:

  1. Open the Sales Item Detail table (pub.demo.retail.item).
    1010data displays the Sales Item Detail table.

Next, perform a row selection to get the two days in which you are interested.

  1. Click Rows > Select Rows.
    1010data displays the Select Rows dialog.
  2. From the drop-down list preceding the first is between label, select Date. In the next field, enter 20120517, and in the last field, enter 20120518.

  3. Click Select.
    1010data displays the results of your selection.

    Next, you will create your cross tabulation. This will give you the totals for both the stores overall, and the totals for each of the two dates you selected.

  4. Click Analysis > Cross Tabulation.
    1010data displays the Cross Tabulation dialog.

  5. Enter Sales by Store by Date in the Title field.
  6. Under the What vales do you want to use to group the records? section, complete the following:
    1. In the first drop-down list under Rows of Result, select Store.
      This selection creates a row for each store in the cross tabulation.
    2. In the first drop-down list under Sort, select Up.
      This selection sorts the new rows in ascending order by store number.
    3. In the first drop-down list under Columns of Result, select Date.
      This selection creates a column for each date for which the store had sales.

Next, you need to select the summary type. The summary applies to both the row grouping and the column grouping. In this case, we are calculating total sales by date for each store.

  1. Under the Which summary data would you like to see? section, complete the following:
    Column Select Sales.

    This selection chooses the column of data you want to act on. In this instance, you want to calculate the total sales.

    Type of Summary Select Sum.

    This selection chooses the action you want to perform on the selected column. In this case, you want to summarize the data in the sales column.

    Reference Column Leave this field blank.
    Display Format Select Currency: $1,234.56.
    Column Width Select Default.
    Decimal Places Select Default.

    Here, your horizontal (row) summary is grouped by store, and the vertical (column) summary is grouped by date.

  2. Click Submit.
    1010data displays the results of your cross tabulation.

    Since you eliminated all the dates except the two you are interested in, you can now create a computed column that shows the difference in sales from one day to the next.

  3. Click Column > Create Computed Column.
    1010data displays the Create Computed Column dialog.

  4. Complete the following fields in the Create Computed Column dialog.
    Column Name Enter dod.
    Column Heading Enter Day-Over-Day.
    Value Expression Enter m1-m0.
    Note: By default, resultant columns in cross tabulations are named m0, m1, etc.

    In this case, to calculate the day-over-day sales, simply subtract the values in the column with the less recent date (m0) from the values in the column with the more recent date (m1).

    Display Format Select Currency: $1,234.56.
    Column Width Select Default.
    Decimal Places Select Default.

  5. Click Submit.
    1010data creates the Day-Over-Day computed column.

    From the results, it is clear that the sales for store 2 plummeted on the last day.

  6. When you are finished with this tutorial, close the Sales Item Detail worksheet.
Cross tabulations are a great way to get further insight into the numbers of regular tabulations. You can keep your totals but see the story behind the numbers by breaking them down into their constituent parts. Next time you're not sure about why a summary looks the way it does, rely on cross tabulations to better understand your data and your business.