Start tracking your progress
Trailhead Home
Trailhead Home

Prepare Your Combined Data in a Recipe

Choose Your Data Preparation Tool

You’ve identified inconsistencies in the US and Canada sales data and that Canadian amounts are in the wrong currency. The dataflow has all the tools you need to fix these issues, but it requires patience, a steady hand, and a whole bunch of formulas. What’s more, you can’t see the data in the dataflow editor, so it’s like working in the dark.

Better to use a recipe, which gives you the same tools but is smart enough to do a lot of the work for you. And being able to preview the data as you clean it up ensures that you don’t miss a bit.

Load Exchange Rate Data

Your Finance team has provided a CSV file with the exchange rates that the company uses for currency conversions. They update these rates monthly. Upload this file in Analytics to use for currency conversion in your recipe.

  1. Download the ExchangeRates.csv file to your desktop from here.
  2. In Data Manager, click the Data tab.
  3. Click Create Dataset.
  4. Click Select a file or drag it here.
  5. Navigate to the ExchangeRates.csv file that you downloaded in step 1, select it, and then click Open.
  6. Click Next.
  7. Click Next.
  8. Click Upload File.
  9. Click the Continue in the background and check progress in the data monitor link.
  10. On the Jobs subtab of the Monitor tab, confirm that the file upload was successful.
  11. Refresh the view to see the latest upload job status.

Add Exchange Rate Data to the US and CA Sales Data

Now you’re ready to start creating the recipe and use the exchange rate data to convert Canadian dollar values to US dollars.

  1. Click the Dataflows & Recipes tab and then the Recipes subtab.
  2. Click Create Recipe.
  3. Click Select Data.
  4. Select the US and CA Sales dataset and click Next. The US and CA Sales input node shows in the recipe graph.
  5. To lookup the exchange rate for each opportunity, start by clicking + next to the US and CA Sales input node and select Join.
  6. Select the ExchangeRates dataset and click Next.
  7. Verify that the Lookup join type is selected.
  8. Confirm that AccountId.BillingCountry and Country are selected as the lookup keys. Analytics has selected these fields because it found values in the account country field that match values in the country field of the exchange rate dataset. This is good news because it’s exactly how you want to match exchange rates to opportunities.
  9. In the Columns tab, select Rate at the bottom of the list to add this column to the recipe. By default, Analytics includes all columns from the recipe and only the selected lookup keys from the data that you’re adding.
  10. Uncheck the Country column. Although it's needed for the lookup, you don't need to include it in your final dataset. We already have the other AccountId.BillingCountry field with this same information.
  11. Click the Preview tab, and then scroll to the right to confirm that the Rate column is included. 
  12. Click Apply. The Join node is added to the recipe.
  13. Click Save to save the recipe. An error appears because you haven't specified an Output node (where to write the recipe results). We'll take care of that in a bit.
  14. Click Continue.
  15. In the Recipe Name field, enter North America Sales, and then click Save.

Now that you have exchange rate data, use a formula to convert Canadian dollar values to US dollars. To add a Formula transformation, you must first add a Transform node.

  1. Click + next to the Join node and select Transform
  2. In the Preview tab, click the Amount column, and then click fx | Custom Formula. The  formula builder opens. The Custom Formula option appears under the fx dropdown.
  3. In the formula builder, select Round from the list of numeric functions, and then click +. The round function appears along with its required parameters in the formula builder.
    Note: If you select Round from the Transform toolbar, the selected field populates in the formula. The Round function appears under Numeric in the functions list.
  4. Hover over the Amount column header to get its API name. When you enter a column in a formula, use the column API name, not the label. The column's API name appears when you hover over it..
  5. In the formula, replace the parameter field with the column API name USandCASal.Amount and parameter numberOfDigits with the value 2. Your formula should look like this: round(USandCASal.Amount, 2).
  6. Scroll down in the transformation details and change Output Type to Numeric. By default, the output type is Dimension.
  7. Leave Precision at 10, but set Decimal Places to 2. 
  8. In the Show Results In field, notice that the results will be written to a new column. Also, the original column will be kept with the original values.
  9. In the Column Label field, change the label of the new column to USD Amount.
  10. Click Apply to add the Formula transformation as a step in the Transform node.

Clean the Stage Data

Your recipe has data from different sources and this can lead to inconsistencies and dirty data. For example, you know that opportunity stages in the Canada org are slightly different than stages in the US org. (You know because you changed them right after you signed up for the Canada org.) Use the Replace transformation to fix the inconsistencies in the StageName column.

  1. In the Preview tab, click the StageName column, and then click Replace transformation button in the Transform toolbar. The Transform toolbar changes based on the number and type of columns selected in the Preview tab.
  2. Enter ValueProposition in the Find field and Value Proposition in the Replace field. 
  3. Looking at the Show Results In field, notice the new value will overwrite the existing value in the original column.
  4. Click Apply.
  5. Repeat steps 1-3 to replace Negotiation/Review with Negotiation & Review in the StageName column.

So you’ve cleaned up the stage data. Great! Next, we're going to clean up some columns. For example, you no longer need the Amount and Rate columns that you used to convert amounts to US dollars in the new USD Amount column. Let’s tidy those up next.

Drop Columns and Change Labels

Your recipe has columns that you don’t need. For example, it’s unlikely that any one would ever want to analyze account IDs. And many columns that you might want to keep have unfriendly names. AccountId.BillingCountry, anyone?

Use the Columns tab for an uncluttered place to drop columns and change labels.

  1. Click the Columns tab. Let's drop some columns from the recipe so they don't appear in the final dataset.
  2. Select the AccountId column, click Drop Columns transformation button, and then click Apply. The column is dropped from the recipe.
  3. Repeat step 2 to drop the following columns
    • OwnerId
    • Id
    • Amount
    • Rate
      Tip: Instead of creating a separate Drop Columns transformation for each column, use Cmd+click for MacOS or Ctrl+click for Windows to select multiple columns, and then apply a single Drop Columns transformation.
      Now let's clean up some column labels. 
  4. Select the AccountId.Name column, click Edit Attributes transformation button, change the label to Account Name, and click Apply. Change the column label in the left pane of the Edit Attributes transformation settings.
  5. Repeat step 4 to change these column labels as well.
    1. AccountId.BillingCountry to Account Country
    2. OwnerId.Name to Owner
    3. AccountId.BillingCity to Account City
    4. AccountId.BillingState to Account State/Province
    5. CloseDate to Close Date
    6. AccountId.Type to Account Type
    7. LeadSource to Lead Source
    8. AccountId.Industry to Industry
    9. OwnerId.Title to Owner Title
    10. CreatedDate to Created Date
    11. StageName to Stage
  6. Click Save to save our latest recipe changes.
  7. At the top of Data Prep, click the Preview tab.

Ahh, that’s better. Your data preparation tasks are done. All that’s left to do is specify where to write the results and then run the recipe to write the results to the specified target.

Create the Dataset and Explore

It's time to add an Output node, which indicates where to write the recipe results. You want to write the results to a dataset. After you specify the dataset details, run the recipe to create and view the final dataset.

  1. Click + next to the Transform node and select Output.
  2. In the Dataset Display Label field, enter North America Sales. When the dataset API name is not specified, Analytics generates the API name based on the label.
  3. Although you can change the app that stores the dataset, leave the default app My Private App in the App Location field.
  4. Click Apply.
  5. Click Save and Run to save and run the recipe.
  6. To see the results, click Back to Data Manager.
  7. In the Monitor tab, check that the status of the North America Sales_recipe job shows Successful. If the status shows as Queued or Running, click The refresh button at the top of the Monitor tab to refresh the view until the recipe job finishes. The Monitor tab has a Jobs and Dataflows subtab. By default, the Jobs tab opens.
  8. After the recipe completes successfully, click the Data tab.
  9. To the right of the new North America Sales dataset, click The menu button on the right of a dataset on the Data tab and select Explore.
  10. Under Bars, click the Add a Group button (+) and select Account Country.
  11. Under Bars, click the Add a Group button (+) and select Stage. Opportunities from both countries now have the same stage names.
  12. Under Bar Length, click Count of Rows, click Sum, and then click USD Amount. All values are now in US dollars.

Wrap Up

Congratulations! You’ve created a North America Sales dataset with local US Salesforce data and remote Canada data, using a connection, data sync, a dataflow, and a recipe. To give your VP of North America Sales fresh data each day, schedule these data jobs to run on a daily basis. Now you’re ready to take on the rest of the world!