To define the results of a query, you choose the data to use as its fields and filters, from sources you have permission to access in the Workiva Platform:
- Wdata tables
- Spreadsheets
- Queries that don't have Crosstab enabled
- ESG
From a query, you can choose and manage its source data from the Sources left panel.
Note: To help browse the Sources panel, click Expand all or Collapse all to show or hide all columns. To find a specific source, click Show filters , and search by its name.
Add sources to a query
To include data in a query, first add its source as well as the columns to pull data from. When you add a source to a query, you can use its columns in the results, as a filter, or within a calculation.
To use data from a Wdata table in a query:
- From the query's Sources panel, click New source, and select Table.
- Search for and select the tables with the columns to use in the query, and click Add.
Tip: To verify you select the correct table as a source, right-click it on the Sources panel, and select Preview table to view its data.
- If you add multiple sources to the query, add relationships to define how to combine—or join—their data.
- From the Sources panel, specify how to use the table's columns:
Tip: In a dimension table, a Key column indicates data unique to each row, such as ID.
- To use columns as results in Builder, select them and Add to fields on the Sources panel, or drag them to the Fields tab. After you specify the columns to use as query fields, set up how they should appear.
- To use columns to define the query's criteria in Builder, select them and Add to filters on the Sources panel, or drag them to the Filters tab. After you specify the columns to use as filters, set their properties.
- To include a column in the query's statement in SQL, right-click it on the Sources panel and select Add to query.
- To use columns as results in Builder, select them and Add to fields on the Sources panel, or drag them to the Fields tab. After you specify the columns to use as query fields, set up how they should appear.
To use data from Spreadsheets in a query:
- From the query's Sources panel, click New source, and select Spreadsheet.
- Search for and select the spreadsheet with the data to use in the query.
- Select the sheets in the spreadsheet that contains the data, and click Add.
- If you add multiple sources to the query, add relationships to define how to combine—or join—their data.
- Specify how to use the spreadsheet's columns:
- To use columns as results in Builder, select them and Add to fields on the Sources panel, or drag them to the Fields tab. After you specify the columns to use as query fields, set up how they should appear.
- To use columns to define the query's criteria in Builder, select them and Add to filters on the Sources panel, or drag them to the Filters tab. After you specify the columns to use as filters, set their properties.
- To include a column in the query's statement in SQL, right-click it on the Sources panel and select Add to query.
- To use columns as results in Builder, select them and Add to fields on the Sources panel, or drag them to the Fields tab. After you specify the columns to use as query fields, set up how they should appear.
Note: Only queries without Crosstab enabled can provide data for other queries.
To use the results from another query to a query:
- From the query's Sources left panel, click New source, and select Query.
- Search for and select the query with the results to use, and click Add.
- If you add multiple sources to the query, add relationships to define how to combine—or join—their data.
- Specify how to use the columns from the query results:
- To use columns as results in Builder, select them and Add to fields on the Sources panel, or drag them to the Fields tab. After you specify the columns to use as query fields, set up how they should appear.
- To use columns to define the query's criteria in Builder, select them and Add to filters on the Sources panel, or drag them to the Filters tab. After you specify the columns to use as filters, set their properties.
- To include a column in the query's statement in SQL, right-click it on the Sources panel and select Add to query.
- To use columns as results in Builder, select them and Add to fields on the Sources panel, or drag them to the Fields tab. After you specify the columns to use as query fields, set up how they should appear.
Open a source from a query
To open the table, query, or sheet where the query pulls data, from the Sources panel, right-click the source and select Go to source .
Note: To view a source table's data without opening it, right-click it on the Sources panel, and select Preview table .
Update a source's columns
A source's columns may change over time. To pull the latest columns from a source query or spreadsheet—such as to include a new column in the query—from the Sources panel, right-click the source and select Refresh .
Note: When you run a query, it automatically pulls the latest data from its sources.
Remove a source
If you no longer need a source's data or add the wrong source, you can remove it from the query. From the Sources panel, right-click the source and select Remove source .
Replace a source
If your query points to an incorrect data source -- perhaps after completing an import -- you can replace that source with a different file. This will automatically update your SQL code with the correct syntax. From the Sources panel, right-click the source and select Replace source.