Skip to main content

Hello,

 

I am using Tableau Prep to clean up my data source from Salesforce before moving it to Tableau to create visualizations. I've performed a few clean/pivot steps but am stuck at one last step before generating an output.

 

I've had to split the data into rows based on multiple values in a column. The pivot function caused several rows to be created that should not exist. One filed in the Salesforce form is called 'Audience Type' and the user has the option to select as many relevant options as needed. If the user selects, among other options, an option called ‘Dealer’, they then have to select a list of dealers – this is also a multi select field.

 

For the data analysis part, I need to split the entries in the ‘Audience Type’ field and create a new row for each entry. For example, if the entries in the field include ‘Dealers, Academics, Growers’, I need to create separate rows for each audience type. Further, if ‘Dealer’ is selected as an Audience type, the user has to select dealer names from a list.

 

Image 1 shows a visual representation of the raw data from Salesforce.

 

Image 2 shows a visual representation of the result from using the Split/Pivot commands on the 'Audience Type' column.

 

At this point, I will need to delete the ‘Dealer Name’ entries in the ‘Grower’ and ‘Academic’ rows because the ‘Dealer Name’ does not pertain to those ‘Audience Types’. I will need to do this before I split this data on the ‘Dealer Name’ field. Failing which, the data will be as shown in image 3, which is inaccurate.

 

How do I programmatically delete cells (or change the values to null) based on the value of a different cell. If were to write this in layman’s terms, I would write a statement such as –

 

IF ([Audience Type]<>”Dealer”, THEN [Dealer Name]=””) or something on those line.

 

How do I translate this into Tableau Prep?

 

Image 4 is how I would like the data to look when these operations are performed correctly.

 

Thank you in advance for your help!

2 件の回答
  1. 2021年12月18日 2:18

    Something like this should work:

     

    Create a calculated field and use this:

     

    IF [Audience Type]<>”Dealer” THEN null END

0/9000