1 Reply Latest reply on Dec 16, 2016 2:42 PM by Dan Huff

    Unable to views all the values in a calculated when dragged in to sheet..

    Udayambika Nair

      Hi All,

       

      I have two data sources.

       

      1) Location Data.

      2) Cost Details.

      Blending is done on Location(Location data) and Location(Cost Details).

       

      What i am trying achieve is i have date dimension coming from cost details which needs to be looked up, based on Cost Scope Start and Cost Scope End.

       

      For example when date(cost details) is in between Cost Scope Start(location data) and Cost Scope End date(Location data) then it means 0,1,2,3 as per logic as shown below:

       

      Measure name: Cost Scope Logic

       

      if (ATTR([Cost Scope Start]) <= ATTR([Cost Details].[Date])

      AND  ATTR([Cost Scope End]) >= ATTR([Cost Details].[Date])

      ) then 1

      ELSEIF (ATTR([Cost Scope Start]) <= ATTR([Cost Details].[Date])

      AND  ATTR([Cost Scope End]) <= ATTR([Cost Details].[Date])

      ) then 2

      ELSEIF (ATTR([Cost Scope Start]) >= ATTR([Cost Details].[Date])

      AND  ATTR([Cost Scope End]) >= ATTR([Cost Details].[Date])

      ) then 3

      else 0 END

      Issue:

       

      1) when i drag this Cost Scope logic measure in row shelf to the sheet i only see the Zero been populated as shown in "Sheet 5" , i am unable to see 0,1,2 as per logic.

      However when i drag in location in sheet of row shelf or at detail level i am able to see all the values 0,1,2 as per logic as shown in "sheet 6".

       

      2) As per below image i am not able to see "2" in filter option. However when i drag location in level of detail i see "2" in the filter as shown in "sheet 7", however the percentages  shown at location level, but i want to aggregate all the percentages like shown below with "2" selected in the filter.

       

      Please help.

       

       

       

        • 1. Re: Unable to views all the values in a calculated when dragged in to sheet..
          Dan Huff

          This issue is occurring because ATTR (or attribute) is an aggregation type within Tableau. This means that without some of your dimensions in the view, it is running this calculation over what is essentially the whole dataset instead of the individual rows. ATTR checks whether the min of a value is equal to its max. If they are equal, ATTR returns a value. If they are not equal, ATTR returns a * to denote that there were differing min/max.

           

          Consider the following data:

           

          Country     Region

          USA          NA

          Canada     NA

          England     EU

           

          If I built a viz with Region on the row shelf and then put a calc of ATTR(Country) out in the viz, I would get a * for NA and England for EU. Since the min is equal to the max for EU, we are able to return England. For NA, however, the min would be Canada and the max would be USA.

           

          In order to get a value for ATTR(Country) for each row in my case I would have to add Country to detail.

           

          This aspect of ATTR is even more important given that you are using blending. Without information from your linking field in the viz, Tableau has to check the ATRR(<your field from secondary ds>) against the entire secondary DB.

           

          You either need to combine these two datasets into a single source so that you can use row level calculations without ATTR or you have to add dimensions to the viz itself (either on the row/column shelves or on detail).

           

          I hope this helps,


          Dan