2 Replies Latest reply on Mar 4, 2016 9:07 AM by Kennen Gross

    Blend based on aggregate

    Kennen Gross

      I have a patient demographic dataset that has one record per patient.  I have a second dataset with prescription claims where each row represents a different prescription and there is a patient identifier for each prescription.  What I would like to do is take the count of prescriptions for each patient and join it to the patient demographic file.  To do this I know I can do a join which will create a large one (patients) to many (prescriptions) dataset. I was wondering though if it was possible to bring in the prescription data as a separate dataset and from this dataset create the aggregation that I want (patient id & count per patient) then blend this aggregated table with the demographic dataset.  Thanks in advance for any advice.

        • 1. Re: Blend based on aggregate
          Rody Zakovich

          Hello Kennen,


          Quick question. Is it possible for you to do this on the backend, before bringing it into Tableau?


          For example, writing a Query that Aggregates the Prescription Count to a Patient level, and then Joins those results to your Demographic Patient Dataset on Patient Identifier?


          You can do this in Tableau by blending the datasources on the Patient Identifier, but it is not a true join, and you can run into problems if you need to do say, a COUNTD.


          If possible, try to do this in the backend so that Tableau has a single flat file source to work with. This will "generally" give you the most flexibility. But if that is not possible use the Blend. For performance, you could also try pre-aggregating the Prescription Data during the Datasource creation so that you have 1 record per customer.




          • 2. Re: Blend based on aggregate
            Kennen Gross

            Hi Rody,


            Thanks for the suggestion.  The aggregate dataset needs to be a live connection so that the aggregates get updated as more claims come in, so creating the aggregation pre-Tableau won't work.