2. Queries
How to create your first query in tukan?
Last updated
How to create your first query in tukan?
Last updated
Queries let you filter and aggregate data from a table.
With queries, you can sift through the dataset and pull out only the data you need, exactly how you need it.
What's more, queries come in handy when you want to automate reports or dashboards that use the same data over and over. That way, you don't have to stress about updating your spreadsheets or dashboards every time there's new info.
If you've already created a query, and wish to learn about how you can connect tukan to your favorite tools; click here.
Let's create our first query by using the Mexican CPI as an example.
In the explore module of the tukan app, search for "Mexican CPI"; this should filter all datasets realted to Mexican consumer prices.
Next, select the "Query table" button to enter the query module for this particular dataset.
Once you've clicked on the button, you'll be taken to the query module.
Here you can select the indicators you wish to export, and assign filters to the data's columns (or references). You'll also be shown a preview of the data you'r collecting.
If you're on a small screen (or have lots of zoom) the preview will be shown below the filters & indicators panel.
In this case, let's select an indicator from the dataset and perform a filter to get historical data.
For example, in the date filter, we select from to get data since 2014. This ensures you get data since that particular date all the way up to the most recent values.
In the indicator field, we select CPI (the consumer price index), which in this case is the only indicator present in the dataset.
As you can see from the previous screenshot, a preview of the data is immediately shown on the right panel. This is how your data will look like once you export it.
As we discussed, tables can have references, which are additional attributes to the data.
For this example, our CPI dataset has a reference called the CPI Subindex Structure which divides the CPI based on the goods & services consumed by Mexicans.
If we are interested in only some subindices, we can add an additional filter to our query.
Finally, we can export the data to Excel or as a CSV file; or save our query for future reference.
The great thing about tukan is that it's desgined to help you automate the collection of public data; which means that your queries can be saved for future use and can even be integrated directly to your Python scripts, Excel workbooks and Power BI dashboards.
To save a query, simply assign a name and click save. That's it.
For detailed connection guides to each of these tools, please click here.