3 Replies Latest reply on May 31, 2017 5:49 AM by Yuriy Fal

    USERNAME() with OR statement and LOOKUP

    Tim Dries

      Hi Tableau lovers,

       

       

      My problem is the following. In a show/hide logic I want to build there are two parts that need to be evaluated.

      I want to make use of a user validation with an additional OR statement.

       

       

      1) USERNAME()=USERNAME_ID  (to make sure the right person sees "his" rows).

      2) + that person should see all rows where the COUNTRY_DESTINATION contains a country of "his" COUNTRY_ORIGIN.

       

      Capture.PNG

       

       

      I'm stuck because of two reasons:

       

      >>> I dont succeed in combining the USERNAME()=USERNAME_ID with a lookup (as the lookup makes use of ATTR and the username evaluation does not and tableau does not allow this)

      >>> and second, I don't not succeed to get the lookup correct so that rows 5,6,7,8 are also returned in case of USERNAME_ID=1.

       

      • For USERNAME 3 that would be 1,2,3,4,7,8,9
      • For USERNAME 2 that would be 1,2,3,4,5,6,7,9

       

       

      I tried with this filter-formula without success:

       

      =========================================================================================================

      USERNAME()=USERNAME_ID

      OR

      LOOKUP(attr([COUNTRY_DESTINATION]),FIRST())=ATTR(if USERNAME()=USERNAME_ID then [COUNTRY_ORIGIN] end)

      ==========================================================================================================

       

       

      Any ideas on how to approach this?

       

      So on the one hand I want to return all rows from the USERNAME_ID but also all the rows for which there are countries of origin which are found in the column COUNTRY_DESTINATION.

       

       

      Thank you very much, I'm really curious on how I could manage this.

      Kind Regards,

      Tim Dries