4 Replies Latest reply on Nov 9, 2018 8:17 AM by Ahmed Mukhtar

    Cant sum the blended field

    Ahmed Mukhtar

      Hello Tableau Community,

       

       

      I have several datasources and am trying to merge them into one datasource using data blending as below

       

       

      Calculated field: Impressions Sum

       

      if ATTR([Publisher]="Facebook & Instagram")

      then SUM([Facebook].[Impressions])

       

      elseif ATTR([Publisher]="Youtube")

      then SUM([Dataset)].[Doubleclick Bidmanager Api Impressions])

       

      elseif ATTR([Publisher]="Precision")

      then SUM([Dataset)].[Doubleclick Bidmanager Api Impressions])

       

      elseif ATTR([Publisher]="Display")

      then SUM([Dataset)].[Doubleclick Bidmanager Api Impressions])

       

      elseif ATTR([Publisher]="PaidSearch")

      then SUM([Search].[Impressions])

       

      END

       

       

      Problem is, I want a grand total of impressions but it becomes blank when attempt summing it up.

      How can I sum the impressions using blended fields.

       

       

      Will really appreciate your help!
      Thanks

        • 1. Re: Cant sum the blended field
          Naveen B

          Hi Ahmed,

           

          Check this link :

          https://kb.tableau.com/articles/HowTo/showing-grand-totals-with-blended-data

           

          Hope this helps plz mark this answer as correct or helpful to close the thread

           

          BR,

          NB

          • 2. Re: Cant sum the blended field
            Ahmed Mukhtar

            Hi Naveen,

            Thank you for reply.

             

            I have checked the link before but it depends upon the window_sum(). Would the window_sum() work with the sheet which displays a single number?

             

            Can you help me integrating the window_sum to my code considering that I would need a single number in a sheet

             

            Thank you very much

            • 3. Re: Cant sum the blended field
              Naveen B

              Can you attach a sample workbook.

               

              Regards,

              NB

              • 4. Re: Cant sum the blended field
                Ahmed Mukhtar

                Hi Naveen,

                Here is the attached workbook for your reference to explain the senario

                 

                Datasources:

                 

                1.PrimaryDatasource

                  

                ProductChannelPublisher
                FurnitureSocialFacebook
                FurnitureSocialTwitter
                FurnitureSocialInstagram

                 

                2. Datasource1 (Facebook)

                 

                ProductChannelPublisherBudget
                FurnitureSocialFacebook10000

                 

                 

                3. Datasource2 (Instagram)

                 

                ProductChannelPublisherBudget
                FurnitureSocialInstagram20000

                 

                Note that for Twitter, I dont have any datasource

                 

                I am now using a calculated field in the primary datasources as follows

                 

                Budget:

                if ATTR([Publisher])="Facebook"
                then SUM([Facebook].[Budget])
                
                
                elseif ATTR([Publisher])="Instagram"
                then SUM([Instagram].[Budget])
                
                
                END
                

                 

                Desired Output 1:

                I want to use primary datasource as a main datasource and blend the other two datasources with product, channel, publisher and have a total budget with a grandtotal

                 

                ProductChannelPublisherTotal Budget
                FurnitureSocialFacebook10000
                FurnitureSocialTwitter
                FurnitureSocialInstagram20000
                Total30000

                 

                Problem 1:

                1) Grandtotal: Because the Twitter is not there, I am unable have a grandtotal of the displayed. Its NULL

                 

                Desired Output 2:

                I want to use a primary datasource publishers to select multiple publishers as a filter in a dashboard which displays the sum of budgets (based on selection)

                e.g.

                a) If I click Facebook it should display 10000.

                b) If I click facebook and Twitter both, it should still display 10,000

                c) if I click all three, it should display 20,000

                 

                Problem 2:

                Case a works but Because of the blending, when I select more than 1 datasource, it display null for case b and c

                 

                 

                I have attached the workbook

                Sheet 1 is problem 1 and dashboard is problem 2

                 

                Will really appreciate your help