Updating Existing Data

Applies to Write-Back Server and Write-Back Cloud

Question

How can I update existing data with Write-Back?

When you are using Tableau sometimes you want users to be able to send the new information straight from the dashboards the users are visualizing. However, Tableau is a one-way data stream, which means that any change that you perform in Tableau will not be reflected in the underlying data.

Write-Back can really help you with this, although Write-Back does not actually update the underlying data (if you want to know why you have more information here), it is easy to implement a solution that simulates this operation while still keeping your data governed and secure.

Answer

The attached workbook has the full solution implemented and is using Write-Back public demo environment, for more information on using it check our Public Demo instruction page.

Why Writing to a Separate Dataset?     Tableau: Relationships     Update Underlying Data.twbx

Step 1: Create a table visualization

The goal is to simulate an update of the underlying data, so we should start with a Tableau visualization that is a table at the right level of granularity. This level will typically correspond to the business keys that identify uniquely the information you will be overlaping. 

So, the first step is to create a table at the minimum level of granularity you want to overlap.



Create a table visualization
Create a table visualization



The right column identifies how many rows the data set has for the product name / order date combination. These two fields will act as a the business keys.





Step 2: Set Up Write-Back for Data Update

In this instance, you will have the fields that are part of the primary key as source fields being obtained from Tableau plus the fields that you want to update as inputs. This approach ensures there is always a correct match between the user inputs and your existing data, as the business keys always come from the data. Let's say that you want update the quantity or sales, you need to create these fields in Write-Back.

You configuration should look like this:

  • Primary Keys in the Write-Back Source Fields

  • New Input Fields - e.g. Quantity or Sales

  • Keep Write-Back in Form View





Step 3: Join with existing data

This solution implemented in the previous step involves writing the corrected values in a different table than the one where the original data are, so it is then necessary to join the two data sources.

For this you can use Tableau relationships and connect your existing data with the Write-Back dataset using the keys defined.

Join with existing data
Join with existing data

Don't forget to filter Write-Back table by IsActive set to True to ensure you only get the latest snapshot provided by the users for each record. 

Step 3: Modify the Report to Include the Updates

Finally you want to show the end result to users and overlap the data. For this you need to create a new calculated field on Tableau for each input field that you created in Write-Back configuration. 

This calculated field has the function of verifying whether there is a value for that primary key or not on Write-Back:

  • If there is a value, the report show the value from Write-Back

  • otherwise it shows the original value

This way you get the best of both worlds, a well governed dataset for manual inputs and the end result looks like an update on the original data.

Optionally, you can display if a field was updated or not by creating another calculated field.

Step 4: One-to-One updates

Another factor that you should keep in mind is that: 

  • You can perform multiple updates for a specific key and to show only the most recent, you need to create a new calculated field with an LOD expression.

  • In alternative you can activate Write-Back setting of Unique Entries and this way Write-Back will ensure there is only one update per entry and regular calculated field will always work.

You can really choose the option that best suites your use case.