3 Replies Latest reply on Sep 21, 2018 9:24 AM by Esther Aller

    Ignore Filtration and Show All Results in case the passed key is of specific value

    Yazid Erman

      Hello Tableauers,

       

      As a Data Level Access, I have built a dashboard that accepts the User ID as a parameter, based on which I filter the data, and show only related rows, the User ID is one of the fields in the data set, then a simple filter would do the job. But in case the user Id is related to a user of type: "Admin", which is also a field in the same data set, I want to show all the rows without filtration.

       

      I have tried so far many workarounds based on Conditional Filtration, but didn't manage to make it work so far, for example:

      • Creating a Calculated Field which includes the concatenation of Admins IDs, and on passing the parameter, a condition instruction will check if the passed ID is included by the Admin IDs or not, and based on it, do the filter or show all.
      • Creating another DataSet, which is based on a custom query to show only one field of the concatenated Admin IDs, and use it directly in the filter condition, as in the first point.

      In both cases, the Concatenated Admin IDs string is refused by Tableau as an Invalid parameter.

       

      Is there any thoughts or workaround for a similar issue.

        • 1. Re: Ignore Filtration and Show All Results in case the passed key is of specific value
          Esther Aller

          Hi Yazid,

           

          I think you were on the right track with the calculation, although I wouldn't concatenate all possible admin IDs. If the data only has one field called [User ID], and the only way you know someone is an admin is by their user ID, then I would recommend something like this:

           

          [User ID] = USERNAME()

          OR

          [User ID] = "123"

          OR

          [User ID] = "124"

           

           

          If you can give us a bit of sample data, there might be a more elegant solution we could find.

           

          Hope this helps

          • 2. Re: Ignore Filtration and Show All Results in case the passed key is of specific value
            Yazid Erman

            Thank you Esther,

             

            The problem is that I don't have a specific one Admin, in each rwo, we include a type for the user, and if the type is ADMIN, then we want to show all the records without filtration.

             

            In other words, supposing that we have the following two records:

            Obj1,User1, USER

            Obj2, User2, ADMIN

            and we pass the User Identifiant as a parameter (or filter), we git the following:

             

            for User1, we should get only the first row

            for User 2, we should get the two rows.

             

            Note please that we don't actually pass User1 or User 2 as a simple ID, we filter by an encrypted Key as a security measure instead.

            • 3. Re: Ignore Filtration and Show All Results in case the passed key is of specific value
              Esther Aller

              Hi Yazid,

               

              In that case you may want something like:

               

              { FIXED : MIN( IF USERNAME() = [User ID] THEN  [Is Admin or User] END ) } = "ADMIN"

              OR USERNAME() = [User ID]

               

              The first FIXED statement will return of the value of [Is Admin or User] for the signed in user in every record in the underlying data. Therefore if the signed in user is an admin, they will be able to see everything.

               

              I am not sure how the encrypted key would play in. Tableau Desktop only knows the signed in user by USERNAME() or FULLNAME(), which pulls the username or full name of the signed in user. Something in the data would have to match one of those values for this calc to work.

               

              Hope that helps