9 Replies Latest reply on Apr 17, 2019 5:49 AM by Daniel Teo

    LOD query in EXASOL (OR clause in JOIN statement)

    Daniel Teo

      Hallo,

       

      I have a question on the (EXASOL) query Tableau generates when writing a LOD calc, more specifically whether there is any way I can influence how Tableau writes its queries.

       

      I have a LOD calc (in Tableau 9.3.3) that looks something like this, which calculates the minimum date for each player profile. I use a Include/Exclude instead of Fixed because the minimum date is dependent on the dimensions in the viz or filters.

       

           {INCLUDE [Profile ID]: MIN(

           {EXCLUDE [Game End - Date (Dim)]: MIN(

           [Game End - Date]) })

           }    

       

      I then have a 2nd calculation to count the number of new users:

       

      COUNTD(IIF([Game End - Date] = [LOD calc], [Profile ID], NULL))

       

      So Tableau generates a subquery and joins it with the main fact table, which is what I want, except for the fact that Tableau adds an OR clause in the JOIN statement:

       

           INNER JOIN

             (

             ----

             ) "t0"

           ON ("PLAYER_PROFILE_DIM"."PROFILE_ID" = "t0"."PROFILE_ID")

          OR (("PLAYER_PROFILE_DIM"."PROFILE_ID" IS NULL) AND ("t0"."PROFILE_ID" IS NULL))

       

      When I remove the OR clause and run the query in my SQL IDE, I get the results I want in about 3 seconds, but the query doesn’t finish (I killed it after 10 minutes) when I leave it in. So my question is: is there a way to tell Tableau not to add this OR clause?

       

      Thanks!