7 Replies Latest reply on Aug 27, 2013 7:43 AM by Emil Schweiger

    group by multiple (date and string) criteria doesn't work

    Emil Schweiger

      Greetings fellow Tableau enthusiasts,

       

          I have been trying to group a certain set of countries by the multiple criteria of

      a, their name (i.e. if [COUNTRY]='countryA') and

      b, the date (i.e if [DATE]<"01/04/2013"

      then 'countryGRP1'

       

      which is necessary as one of the countries have recently have been folded 

      in our company's organizational structure into another country's sales dept.

      (as subsidiary).

       

      So I would need to create a grouping where if the date is less then defined limit

      then "countryA" would be handled as itself (i.e. 'countryA') else if the date field

      value is more than this set date then the country is grouped into 'countryGRP1'.

       

      Unfortunately Tableau tells me not to compare date and string values or integer

      and date value for that matter (which is strange since I'm trying to use a solution

      on this ()  field.

       

      The calculated field looks like this:

      IF [COUNTRY]= 'NBL'

      THEN 'NBX'

      ELSEIF [COUNTRY]='NNL'

      THEN 'NBX'

      ELSEIF [COUNTRY]='ND'

      THEN 'ND'

      ELSEIF ([COUNTRY]='CH' AND STR([DATE])<"01/04/2013")

      THEN 'ND'

      ELSEIF [COUNTRY]='NFR'

      THEN 'NFR'

      ELSEIF [COUNTRY]='NI'

      THEN 'NIT'

      ELSEIF [COUNTRY]='NE'

      THEN 'NIB'

      ELSEIF [COUNTRY]='PT'

      THEN 'NIB'

      ELSEIF [COUNTRY]='NUK'

      THEN 'NUK'

      ELSEIF [COUNTRY]='OTH'

      THEN 'DIST'

      ELSEIF [COUNTRY]='OTH_Static'

      THEN 'DIST'

      ELSEIF [COUNTRY]='SE'

      THEN 'DIST'

      END

       

        thanks in advance

       

      Emil