4 Replies Latest reply on Jan 31, 2012 12:47 PM by guogang.hu

    Join CSV, Excel

      For example, if I have list of stores in CSV file (columns: store name, store address), and list of items sold in Excel (columns: store name, item name, sales date, price). How can I join these two data source, so that I can plot, for example, each store's total sales by month?

       

      I only found "Relationship" kind of helps. But if I created a relationship on store name, then everything seem to be aggregated by store already. I can no longer break down by sales month.

       

      Thanks

        • 1. Re: Join CSV, Excel
          Richard Leeke

          It sounds as if you only need the CSV of stores to look up the store address.  so you need to make the items the Primary Data Source (i.e. put fields from there onto your view before you put any fields from the stores data source).  That way you have available all the detail from items.

          • 2. Re: Join CSV, Excel

            Thanks. This is very helpful. That is the solution I'm looking at.

             

            Related topic. Please let me know if the behavior below is a bug, or by design.

             

            I was stuck before, because I could not make Tableau to reverse my first relationship definition. Here is what happened:

            1. I first created a relationship with store being the primary data source;

            2. When things are aggregated, I clicked "Data" > "Relationships", and in the dialog changed primary data source to sales data, then click on "OK";

            3. The chart did not change a bit;

            4. Since your response gave me a bit more confidence, I created a new workbook from scratch, then everything works as expected;

            5. Going back the old workbook, turns out my edits did not stick. Tableau still think "store" is primary data source, even if I did the edits, and no error or warning was given;

             

            (software version 6.1.5)

            • 3. Re: Join CSV, Excel
              Richard Leeke

              I think you'll find that actually it lets you view the relationship either way - so whichever data source you set as the primary in the Relationships dialog it just arranges the fields appropriately.

               

              The thing that determines which data source is the primary on each viz is which one you use fields from first.  So you could have two sheets, one with one as the primary and the other with the other data source as primary.

              • 4. Re: Join CSV, Excel

                Thanks. That explains it. I tried to drop all the fields from my old worksheet, and add fields from primary table first, then it works as expected. No need to start a new workbook.