1 Reply Latest reply on Jul 18, 2012 8:18 PM by Dimitri.B

    How does the sample feature on the Extract Data dialog work?

    ilse.ackerman

      How does the 'Sample' feature on the Number of Rows section of the Extract Data dialog work?

       

      Specifically,

      • Does it produce a random sample of rows?
      • What is the SQL equivalent of what the 'Sample' feature does?
        • 1. Re: How does the sample feature on the Extract Data dialog work?
          Dimitri.B

          Here is what Tableau Desktop Help has to say on the subject:

          ...You can extract All, the Top N rows, or a Sample from the data source. Tableau first applies any filters and aggregation and then extracts the number of rows from the filtered and aggregated results.

           

          The number of rows options depend on the type of data source you are extracting from. For example, not all data sources support sampling so that option is not always available.

           

          I guess it relies on data source's built in functionality to pick random rows. I also guess that in Oracle the SQL equivalent would be something like:

           

          --select 100 random rows

          SELECT column FROM

          (SELECT column FROM table

             ORDER BY dbms_random.value) --dbms_random.value is Oracle's built-in random number generator

          WHERE rownum = 100;

           

           

          Something similar can also be found in other databases, but, as Tableau Help helpfully hints, not all.

          1 of 1 people found this helpful