Variables are a lot of fun in Klipfolio. They make the data in your Klips reactive.
To add the example Klip used in this article to your Dashboard click this link. Example Klip - User input Control
There are three types of variables:
- Drop-down list - By far the most common. This is where you select from a drop-down list of options and the data changes to reflect the selected option.
- Date picker - This is where you select a start date and end date and your date changes to match that date range.
- Text - This is where a user types in say Canada, and the data filters to display Canadian values.
Variables are typically created in a User Input Control component. Some functions like MAP also use variables. You insert variables using the (x) button.
For this example, create two drop-down list variables in two different User Input Control Components. Call one variable nlcountry and for Values specify the formula
GROUP ( A:A ). Call the other variable nlcity and for Values specify the formula
GROUP ( B:B ). When evaluated, a unique instance for country and city are returned in two seperate drop-down lists.
Tip: You can test variables in the Klip editor. For example, click on nlcountry nlcountry and type in an expected Klip Editor Value, say New Zealand. When the formula is evaluated the correct values should display. But remember, you also need to do the same for nlcity.
Having created two variables, we can now build our Bar/ Line Chart formulas. We will use the SELECT function, so that when a user selects a country AND a city, the Bar/Line Chart displays the corresponding value.
The formula for X:Axis and then Series are:
SELECT( A:A , AND( ( A:A = nlcountry ) , ( B:B = nlcity )))
SELECT( C:C , AND( ( A:A = nlcountry ) , ( B:B = nlcity )))
This Klip uses the following data source file:
Now that you know more about the DATE and DATEVALUE functions, check out the following tutorials:
- Tips and Techniques - Function examples
- Tips and Techniques - Task examples
- Tips and Techniques - Google Analytics examples
These articles provide an overview of important concepts for building Klips: