Restricting rows in datasets based on SQL query

You can restrict which rows are included in a dataset by modifying the SQL query to filter records.

SQL-defined datasets make it easy to limit dataset content to specific rows by adding filtering conditions (for example, using a WHERE clause). This allows you to control the subset of data available for analysis based on your requirements.

  1. Switch to Dataset Detail interface, and edit SQL text window by applying the following statement:
    select county, stname, ctyname, tot_pop, tot_male, tot_female from main.us_counties
      where stname in ('Arizona','New Mexico', 'California','Nevada','Colorado','Utah')
  2. Click Save.
  3. In the Refresh dataset table column information modal , click Close.
  4. Switch back to the Data Model interface, click Show Data, and notice that the dataset is limited to the states specified in the SQL statement.
  5. If you were to test it by creating a simple map visual on the dataset, it would look something like this: