Skip to main content Skip to complementary content

Calculating the total purchase amount including taxes

A pipeline with an S3 source, a Math processor, and an S3 destination.

Before you begin

  • You have previously created a connection to the system storing your source data.

    Here, an Amazon S3 connection.

  • You have previously added the dataset holding your source data.

    Download and extract the file: math-prices.zip. It contains a dataset with data about the latest purchases of customers with pre-tax prices as well as the tax amount to be included.

  • You also have created the connection and the related dataset that will hold the processed data.

    Here, a dataset stored in the same S3 bucket.

Procedure

  1. Click Add pipeline on the Pipelines page. Your new pipeline opens.
  2. Give the pipeline a meaningful name.

    Example

    Calculate customer purchases including taxes
  3. Click ADD SOURCE to open the panel allowing you to select your source data, here the last purchases of customers with tax information stored in Amazon S3.
    Preview of a data sample about customer purchases.
  4. Select your dataset and click Select in order to add it to the pipeline.
    Rename it if needed.
  5. Click Plus and add a Math processor to the pipeline. The configuration panel opens.
  6. Give a meaningful name to the processor.

    Example

    calculate price including tax
  7. In the Configuration area:
    1. Select Add, substract, multiply, and divide in the Function name list as you want to add the tax amount to the price of the purchase.
    2. Select .latest_purchase_pre_tax in the Fields to process list, as it corresponds to the price of the last purchase without tax.
    3. Enable the Create new column option to display the result of the calculation in a new field.
    4. Select + as the Operator as you want to calculate the sum of two fields.
    5. Select Other column in the Use with list and .tax in the Column list as you want to add the tax amount to the original price.
  8. Click Save to save your configuration.

    Look at the preview of the processor to compare your data before and after the calculation operation. You can see that the type of the calculated data has been automatically converted to number.

    Preview of the Math processor after applying a calculation operation.
  9. Click ADD DESTINATION and select the dataset that will hold your output data.
    Rename it if needed.
  10. On the top toolbar of Talend Cloud Pipeline Designer, click the Run button to open the panel allowing you to select your run profile.
  11. Select your run profile in the list (for more information, see Run profiles), then click Run to run your pipeline.

Results

Your pipeline is being executed, a new field that contains the total amount of the last customer purchases including taxes is added to the original dataset and sent to the target system you have indicated.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!