Reports: Applying Filters to a Chart
Spiro Reports offers powerful Filtering options to filter the necessary records that are to be plotted in the report you create. The Filtering options are the same for all types of reports that you create in Spiro Reports - charts, pivot table & summary views.
Depending on the data type of the column, you can filter specific numeric ranges, date ranges, individual values, top10, bottom 10, etc., Spiro Reports also allows you to apply multiple filters (based on multiple columns) on a report. The filtering options discussed in this topic can be applied only when you are designing a report (i.e., when you are in design mode) and not in the view mode.
To create a filter, after you have created the required chart (or pivot or summary view)
- Select the required Chart.
- Click the Edit Design option in the toolbar.
(or)
- Right-click on the Chart name listed on the left side of the reporting database and select Edit.
- Click the Filters tab next to the Graph tab in the design area. The Filters Tab has three boxes as shown in the screenshot below. Filter Shelf (Box) to drop the columns, the second box displays the filter options and lists all the possible values for filtering and the third box displays added filter items.
- Drag and drop the required columns into the Filter shelf.
Note:
- In the case of Charts you can use the Add to Filter icon () next to X and Y axes to quickly add the columns plotted against X and Y axes into the Filters tab.
Once a column is dropped, a list of all possible options for filtering will be displayed in the (second) box right to Filter Shelf as shown in the screenshot above. The filtering options provided varies based on the data type of the column dropped.
Numeric & Currency type:
The following table lists all the possible options for filtering various column data types:
Option | Description |
Individual Values | This option allows you to filter data based on individual values of the selected numeric column. All possible individual values of the dropped column will be listed in the filter tab. You can select these values to filter them. |
Ranges | This option allows you to filter data based on numeric ranges into which the values in the columns can be segmented Eg., 0 to 100, 101 to 250, etc., Filter tab will list a suggested range of values for filtering. You can choose the required range to filter. You can also add your own custom ranges for filtering. |
Top/Bottom N | This option allows you to filter a specified number of Top/Bottom records. For example, Top 10 will filter the top 10 values in the column and Bottom 10, will filter the bottom 10 values in the column. The values will be computed based on the aggregate function applied to the filter column. You can also specify another column for ranking. |
Top/Bottom N% | Top/Bottom N% is similar to the Top/Bottom N option, except that it returns N% of values from the column. For example, Top 5%, will filter the top 5% values of the column. |
If the listed values under each of the option do not meet your needs, Spiro Reports allows you to define your own custom values. You can add your custom ranges, Top/Bottom N and N% values by clicking Add New Range button under the corresponding option.
Text type:
When you drop a Text type column into Filter Shelf, all the distinct values from the column will be displayed as a list in the box next to it, allowing you to filter data based on these values. A search box can also be used to find the required values if needed.
Date type:
The following table lists all the possible options for filtering DATE-type columns.
When you select Actual Values for a Date column dropped in the Filter shelf the following are the options available for filtering.
Option | Description |
Year | Select this option to filter date values based on specific years |
Quarter | Select this option to filter date values based on specific quarters |
Month | Select this option to filter date values based on specific months |
Week | Select this option to filter date values based on specific weeks |
Date | Select this option to filter based on specific date values |
Date & Time | Select this option to filter based on specific date & time values |
Ranges | Select this option to filter values based on specific date ranges |
To enter a custom date range, under the Ranges option click Add New Range. In the Add New Range dialog box that appears, type dates in the From and To boxes or click the calendar icon to open the calendar to select the required dates and then click Add.
When you select Seasonal for a Date column dropped in the Filter shelf the following are the options available for filtering.
Option | Description |
Quarter | Select this option to filter date values based on quarters present across all years in the column. E.g., Q1, Q2. |
Month | Select this option to filter date values based on months across all years. E.g., January, February. |
Week | Select this option to filter date values based on weeks across all years. E.g., Week 1, Week 2. |
Week Day | Select this option to filter date values based on weekdays across all years. E.g., Sunday, Monday. |
Day of Month | Select this option to filter date values based on day of the month across all dates. E.g., 1 to 31. |
Hour | Select this option to filter date values based on hours in a day. E.g., 0 to 23hrs |
When you select Relative for a Date column dropped in the Filter shelf the following are the options available for filtering.
Option | Description |
Common | Select this option to filter data values based on the common relative (relative to current time) periods. E.g., Last 1 Hour, Today, This Month etc., |
Quarter | Select this option to filter data values based on relative period quarters E.g., This Quarter, Last 3 quarters, Next Quarter etc., |
Month | Select this option to filter data values based on relative period months E.g., Last Month, Next 6 Months etc., |
Week | Select this option to filter data values based on relative period week E.g., This Week, Last 3 Weeks etc., |
Day | Select this option to filter data values based on relative period day E.g., Today, Next 5 Days etc., |
Hour | Select this option to filter data values based on relative period hour E.g., Last 1 Hour, Last 12 Hours etc., |
After you have dropped the column and selected one or more values to filter the selected filter items appear in the third box on the right. You can Include or Exclude the selected values from the report that you are designing by choosing the appropriate option on top of this filter items box.
Once you are done with selecting the appropriate filters, select Click here to Generate Graph link or View Mode button in the toolbar. Notice that only the data that matches the filters you have defined will be displayed.
Note: You could apply any number of filters for a report that you design. When multiple filters are applied the data is filtered by adding all the filter conditions i.e., all the filter conditions should be met for the data to be shown part of the report.
User Filters
Spiro Reports allows you to include dynamic filtering capability in the reports view mode called User Filters. User filters enable your users who access the report, to apply filters on the report data displayed using the filter columns exposed as part of User Filters. The filter columns included in User Filters can be displayed using a variety of display components like Drop Down boxes, sliders, Date range pickers, etc., to suit your needs.
The following sections describe in detail how to set up User Filters for various column types (Datatypes).
User Filters for String (Categorical) Column Type
To add a string (categorical) column as a User Filter, follow the instructions given below:
- Open your report (chart) in Edit Design Mode and then click User Filters tab in the Design Area.
- Drag and drop the required category column which you want to add as user filter in to User Filters tab as shown below. In this example, we are going to filter by the Category column, Product.
- To edit the user filter you will have to mouse over the dropped column and select Edit from the highlighted options.
Step 1: Choose the filter name & component type
On clicking the Edit user filter option it opens a dialog box with options to edit the Filter Display Name and to Choose the Component type for the user filter, as shown in the screenshot below.
By default, dropped user filter column name will be displayed as the filter name. To modify the filter display name, type in the name in the Filter Display Name text box. The settings dialog also provides option to choose the component that is to be used to display the user filter using the Component Type field. In the case of categorical (string) columns you can choose between single select drop down box or multi select drop down box.
- Select Box Option: Select this option to allow chart users to select only one item at a time to filter data against the selected column.
- Multi Select Box Option: Select this option to allow chart users to select multiple filter items at a time to filter data from the drop down list. On selecting this option a check box will be provided next to each filter item allowing users to choose more than one filter item from the list.
After you have selected the required option, click Next go to Step 2.
Step 2: Choose values to list
In Step 2, you could choose the values that are to be displayed in the user filter column, as shown in the screenshot below.
The following are the options available:
List All Values: On selecting this option, all distinct values of the selected column will be listed as selectable items in the drop down list of the User Filter. Users can select any item from the list to filter the report accordingly.
The resultant User Filter in reports view mode would look like as shown below:
List Selected Values: Instead of listing all the values of the column in the drop-down list, you can choose to list only selected values from the column by selecting this option.
To specifically select values to be listed in the User Filter:
- Select List Selected Values option. On selecting this option all the distinct values in the column will appear under Select Values box as shown below. Search box can also be used to find the required values on need.
- Select the values to be listed by ticking the check box next to each value.
- Selected filter items will be displayed under Selected Values box as shown below. To remove selected values from the list, click on the left of the filter item.
Others: On selecting this option an item Others will be added to the user filter list. When user selects this option (in the reports view mode) it will display data corresponding to all other remaining items that are not listed in the user filter drop down.
Specify the default filter value: Use this option to set a default value to the filter that will be automatically applied with the report is loaded/opened. To set a default filter, type the filter value in the text box provided next to Specify the default filter value option. To apply multiple values as default filter, you need to specify the values separating them with a comma.
Behavior when user filters are applied: This option allows you to choose whether or not to cascade user filters. Values available for the option are:
- List only relevant values: Use this option to set up cascading user filters i.e., the list of values available in one User Filter depends on the value that you have chosen in the preceding User Filter(s). For example, let's say you have one user filter to filter Product Category, and a second filter to filter Products in a report. When this option is selected while creating user filter, If you select Furniture in the Product Category filter, only the products which comes under the category Furniture will be listed in the drop down list of the Products filter, instead of listing all the products.
- Always List All Values: Use this option to disable Cascading of User Filters and list all the values in the drop down.
After selecting the required options in the dialog box, click Finish button.
When you view the report in view mode by clicking View Mode button in the tool bar, User Filters with a drop-down filter list appears on the top-left as shown below:
User Filters for Numeric and Currency Column Type
To add a User Filter for a numeric or currency column type
- Open your report (chart) in Edit Mode and then click User Filters tab in the Design Area.
- Drag and drop the required column for which you want to add user filter in to the User Filters tab.
- Hover your mouse over the dropped column and select Edit option from the highlighted options.
Step 1: Choose the filter name & component type
On clicking the Edit user filter option it opens a dialog box with options to edit the Filter Display Name and to Choose Component type for the user filter, as shown in the screenshot below.
By default, dropped user filter column name will be displayed as the filter name. To modify the filter display name, type in the name in the Filter Display Name text box. The settings dialog also provides option to apply aggregate functions like Sum, Max, Min, Average, Standard Deviation, Count and Actual Values on the user filter numeric column, to allow users to filter data based on aggregate value. Spiro Reports provides the following component types for a numeric data type column.
Slider: Default component for a numeric column type is a Slider. Sliders allows users to choose a specific numeric range by adjusting the slider bars accordingly.
Combo Selection: This option will be enabled only when you apply Actual Values function on the user filter numeric column. All the distinct numeric values in the column will be listed in the filter. Users can select one or more values from the combo box.
After you have selected the required component type, click Next go to Step 2.
Step 2: Choose values to list
Step 2 (Choose Values tab ) will be available to you only if you have chosen Combo Selection component type in Step 1. In Step 2, you could choose the values that are to be displayed in the user filter column, as shown in the screenshot below.
The Choose Values tab provides different options to choose the type of values to be displayed in the user filter column. Each of these options are described in the table below.
Option | Description |
Individual Values | A list of all possible individual values of the dropped column will be displayed when you select this option. This option allows users to filter data based on individual values of the selected numeric column. |
Ranges | A list of suggested range of values will be displayed when you select this option. This option allows users filter data based on numeric ranges into which the values in the columns can be segmented. Eg., 0 to 100, 101 to 250 etc., You can even add your own custom ranges for filtering. |
Top/Bottom N | This option allows users filter data to only display a specified number of the Top/Bottom 'N' records in order. For example Top 10 will display the top 10 values in the column and Bottom 10, will display the bottom 10 values in the column. |
Top/Bottom N% | Top/Bottom N% is similar to Top/Bottom N values, except that it returns N% of values from the column. For example Top 5%, will display the top 5% values in the column. |
Select the values to be listed by ticking the check box next to each value. Choose Other option to add an items "Others" to the User filter list, to display data corresponding to all other remaining values that are not listed in the user filter drop down, when a user selects it. Select the value List only relevant values for the option Behavior when user filters are applied to set up cascading user filters i.e., the list of values available in one User Filter depends on the value that you have chosen in the preceding User Filter(s).
After selecting the required options in the dialog box, click Finish button.
When you view the report in view mode by clicking View Mode in the toolbar, the User Filter with a slider or drop-down filter list appears on the top-left as shown below. Users can use this to filter the values in the report.
User Filters for Date Column Type
To add a User Filter for a Date column do the following.
- Open your report (chart) in Edit Mode and then click User Filters tab in the Design Area.
- Drag and drop the required Date column which you want to add as user filter in to User Filters tab.
- Hover your mouse over the dropped column and select Edit option from the highlighted options.
Step 1: Choose the filter name & component type
On clicking the Edit user filter option it opens a dialog box with options to edit the Filter Display Name and to Choose Component type for the user filter.
By default, the dropped column name will be displayed as the filter name. To customize the filter display name, select Filter Display Name option and type the name that you want. The settings dialog also provides option to choose the component that is to be used to display the user filter using the Component Type field. The following are the possible component types that you could choose from for a date column:
- Date Range: Select this option to allow users to select a date range and filter the data.
- Actual Period: Select this option to allow users to filter data based on actual period present in the date column. For example:- 2014, 2015 etc.
- Relative Period: Select this option to allow users to filter based on relative period. For example:- Last 2 months, Last 3 months etc.
- Seasonal Period: Select this option to allow users to filter based on repeating seasonal period. For example, All Sundays, All March months, All Q3 etc
Step 2: Choose Values to list in User Filter
In Step 2, you could choose the values that are to be displayed in the user filter column, as shown in the screenshot below.
The Choose Values tab provides different options depending on the component type you choose in Step 1. Each of these options are described in the table below.
Component Selected | Options in Choose Values tab |
Date Range | Any Date Range: This option allows users to specify any date range for filtering the report data. Specified Date Range: This option allows you to specify range of dates, to restrict users to filter only within that range. Include Time: This option allows to include time component along with Date in filters. |
Actual Period | Select Values: This option allows you to select the actual periods like Actual Year, Quarter, Month, Week, Date and Date & Time to list for filtering the report data. Specify Default Filter: This option allows you to set a default value for the filter that will be applied automatically when the report is loaded or opened. Behavior when user filters are applied: This option allows you to choose whether or not to cascade user filters. Choose List only relevant values option to set up cascading user filters i.e., the list of values available in one User Filter depends on the value that you have chosen in the preceding User Filter(s). |
Relative Period | Select Values: This option allows you to select the relative periods like This Quarter, Last3 Months, Next Week, Today etc., to list for filtering the data. Specify Default Filter: This option allows you to set a default value for the filter that will be applied automatically when the report is loaded or opened. |
Seasonal Period | Select Values: This option allows you to select the seasonal values like All Q3 Quarters, All January months, Week 52 of every year, Every Sunday etc., for filtering the data. Specify Default Filter: This option allows you to set a default value for the filter that will be applied automatically when the report is loaded or opened. Behavior when user filters are applied: This option allows you to choose whether or not to cascade user filters. Choose List only relevant values option to set up cascading user filters i.e., the list of values available in one User Filter depends on the value that you have chosen in the preceding User Filter(s). |
After selecting the required options in the dialog box, click Finish button to complete the settings.
When you view the report in view mode by clicking View Mode button in the toolbar, the User Filter appears on the top-left as shown below. Following screenshot displays how a User Filter for Date column would look like when Date Range component type is chosen.
How User Filters Work
Spiro Reports allows you to provide multiple user filters in a report. Users who view the report can apply any number of user filters provided, in any order he/she wants. When a user applies more than one user filter on a report then the data is by AND'ing all the filter conditions i.e., all the filter conditions should be met for the data to be shown part of the report.