# Building queries > Pick dimensions and measures, add filters, sorts, and a limit, and watch results update as Flax recompiles and re-runs the query in your warehouse. *[View this page in the Flax docs](https://flax-analytics.com/docs/exploring/building-queries)* A query in Explore is a set of choices: what to group by, what to measure, which rows to include, and how to order them. This page walks through each control and how results are produced. ## Choose dimensions and measures From the field-picker, toggle on: - **Dimensions** — attributes you group or slice by, such as `region` or `order_date`. Time dimensions add a **Grain** control (day, week, month, quarter, year) so you can roll dates up to the level you want. - **Measures** — aggregated values, such as `revenue` or `order_count`. Flax groups by every selected dimension and aggregates every selected measure. You need at least one dimension or measure before you can run the query. Fields from a joined model appear in their own section, and Flax resolves the join for you when you combine fields across related models. ## Add filters Filters narrow the rows the query considers. Add a filter on a dimension or measure and pick an operator: equals or not-equals, is one of / not one of a set, the numeric and date comparisons (greater/less than, or between), contains for text, and is-null / is-not-null. All filter values are passed as bound parameters, never concatenated into SQL. > [!NOTE] > Filters you apply are always layered on top of any > [row-access filters](/docs/modeling/row-access-filters) defined in the model. > You can never widen your access by removing a filter. ## Sort, compare, and calculate - **Sort by** a single field, ascending or descending (toggle **Desc**). - **Compare** to the previous period with the **vs. previous period** switch, available once you have a time-grain dimension and a measure selected. - **Table calculations** add a **running total** or **% of total** to a measure. ## Running the query Building a query is deliberate: your selections do not run until you click **Run**. Flax then compiles the SQL for your connection's dialect (Postgres, Snowflake, Databricks, or BigQuery) and executes it in your warehouse, and the result view refreshes. Large results are capped server-side (up to 5,000 rows) so the browser stays responsive; when a result is cut off, Flax flags it as truncated. Reach for tighter filters or a coarser grain if you hit the cap. ## From result to output Once a result looks right you can: - Switch it to a [chart](/docs/visualizations/chart-types) and save it. - Open it in a [sheet](/docs/sheets/overview) for formulas and formatting. - [Drill down](/docs/exploring/drill-down) into a value to see its rows. - Inspect the [compiled SQL](/docs/exploring/query-detail). ## Next steps - [The SQL runner](/docs/exploring/sql-runner) - [Drill-down](/docs/exploring/drill-down) - [Query detail](/docs/exploring/query-detail)