2 Replies Latest reply on Mar 29, 2012 10:08 AM by Jonathan Drummey

    An IF FIRST()==0 THEN ... doesn't work in Tableau 7!!!!

    Teresa Obis

      Hello friends,

       

      I have a very extrange problem. I have a calculations working with Tableau 6.1. But when I save the workbook to 7 the table calculation stops to work, but in some graph still works.

       

      I attach the twbx 6 and 7 to let you see the problem.

       

      In the Computes Worksheet you will find the cascade of calculations:

      *StoresNumber: ATTR(StoresNumber): Number of Stores with the same IDStore

      *Count Stores Nunbers: WINDOW_SUM(ATTR([StoresNumber])) along IDStore : tell us how many stores sell a Family of products

      *First Store Number: IF FIRST()==0 THEN ATTR([StoresNumber]) END along Family: Save the StoresNumber the first occurrece of Family in order to compute the total. --> this is the formula that I do not know why it doesn't work fine.

      *Total Stores Number: WINDOW_SUM([First StoresNumber]) along  IdStore & FAMILY. Sum once the Stores Number to get the total stores number

      *Numeric Distribution:  Is the percent of Stores who sell a concrete family product.

      IF FIRST()==0 THEN

      [Count StoresNumber]/[Total StoresNumber]

      END

       

      For example in my data in January 2011 for the Family of Wellness you will see in Distribution 6 that there are 359 who sell that family product to a total of 378 so the Numeric Distribution is 95%.

       

      But if you save as Tableau 7, I do not know why but the Total Stores Number changes to 283 due some stores do not save the First Store Number.

       

      This is more rare when I notice that these same calculation are well done in the dashboard 3.1.DISTRIB: DA GMD (38.pdf) where I have a bar grahp. The first bar of Wellness is 95%!!!!!!

       

      I could not understand the problem. Could any one help me?

       

      Thank you very much.

       

      Teresa

        • 1. Re: An IF FIRST()==0 THEN ... doesn't work in Tableau 7!!!!
          Teresa Obis

          I've just found the explanation: in the graph I have Family in Columns and in the table Family is in the Rows.

           

          My question now is How I must change the formula if I would like to mantain Family in Rows?

          It is normal that the formula doen't work when the variable is in the Rows?

           

          Any suggestion?

          • 2. Re: An IF FIRST()==0 THEN ... doesn't work in Tableau 7!!!!
            Jonathan Drummey

            Hi Theresa,

             

            In your Tableau 6 workbook, there are 83700 marks on the Computes view. In your Tableau 7 workbook, there are 92970 marks. This could either be due to the workbooks being different or you running into a difference in how Tableau pads data that changed between version 6 and 7.

             

            When I open the Tableau 6 workbook in Tableau 7, those 83700 marks are now 92970 marks. So, I think we're safe in assuming that Tableau 7's new padding behavior is what is throwing your calcs off. Basically, Tableau 7 pads more often than Tableau 6 did.

             

            I don't have a very clear idea of what you intended with your table calcs and you've got so much in the level of detail for the view (two dimensions on rows, two on columns, two sets in the LoD that use some of the dimensions already in the view) and the nested table calcs are complex enough that I'm not really able to help more. I suggest you start with a view with all the dimensions on a single Row, and build your table calcs from there so that they give you the expected results in Tableau 7. Once you have that working, then you should be able to move into crosstabs or charts and have the calcs work.

             

            Jonathan