mercredi 24 août 2016

How to make a random sampling of 20% of records in Tableau?

In Tableau, is it possible to generate a random sample of records? If so, how could I do this? Say I have a field called Field1, then I intend to only select 20% of the records. So far, I have found how to a generate random integer in Tableau:

Random Seed

(DATEPART('second', NOW()) + 1) * (DATEPART('minute', NOW()) + 1) * (DATEPART('hour', NOW()) + 1) * (DATEPART('day', NOW()) + 1)

Random Number

((PREVIOUS_VALUE(MIN([Seed])) * 1140671485 + 12820163) % (2^24))

Random Int

INT([Random Number] / (2^24) * [Random Upper Limit]) + 1

But how could I create a calculated field to only show random records that make up 20% of Field1?




Aucun commentaire:

Enregistrer un commentaire