Search code examples
tableau-apitableau-desktop

tableau, excel workbook, three worksheets, want data sources column in union


I have a question on Tableau Desktop. I have an excel file with three tabs: Applications, Shared Drives, Sharepoint_Libraries. I would like to union all of these tables. I would like a column called Data Source with the below values. So from Applications excel file, I would like a Data Source column in the Union which says Applications. So from Shared Drives excel file, I would like a Data Source column in the Union which says Shared Drives. Lastly, from Sharepoint_Libraries excel file, I would like a Data Source column in the Union which says Sharepoint_Libraries. How can I do this in Tableau? Do I need to edit the source excel files and add the Data Source column in each file? Or, can I create a calculated field called Data Source and use a formula to populate this information?

Data Source
Applications
Shared Drives
Sharepoint_Libraries

Solution

  • Tableau has a "merged mismatched fields" option for this situation.

    So..

    • open Desktop
    • connect to the Excel file
    • drag over the Applications sheet
    • drag over the Shared Drives sheet and position it just below Applications until you see the "union" box appear then release your mouse button
    • repeat for Sharepoint Libraries
    • in the preview window (below) you will see the three different fields.
    • highlight the three fields that you want to merge
    • right-click and choose Merge Mismatched Fields.

    Then you can rename the field accordingly :)