Wednesday, 14 June 2023

Filters - Tableau

 Filters:

Generally we use the filters to reduce the number of records present on the report or to show only required data on the report & to improve the performance.


We can apply the filters at the time of conn


Tableau have the following different kind of filters

•Regular Filters

Regular Filters – Dimensions

Regular Filters – Measures

Regular Filters – Date

Quick Filters

Context Filters



Regular Filters - Dimensions:

  • All fields that are filtered show on the Filters shelf. 

  • We can apply the Regular flirters either by dragging fields onto Filers shelf or in the view right click then select either hide or exclude.

  • Right click on Field from the row shelf.


-> Here we can filter the data in 4 different ways


General

Wildcard

Condition

Top


First Create a simple Report with Region, SubCategory & Sales fields.

Drag Region filed onto Filters shelf.



General: select the required data which should only be showed on the report.( Ex: Select required Region by dragging Region filed onto Filters Pane)




Select the East region then apply.




Wildcard: We can filter the data by applying Wildcard. ( Ex: Select required Region by dragging Region filed onto Filters Pane, then click on wildcard, then use the options to get the required data on the work area, here )











Condition: 

1) Create a simple report with Region, Sub_Category & Sales fields.

2) Drag Region field onto Filters Shelf, then select 'Condition'.

3) Select the Condition, Select 'ByField', Select 'Sales', 'Sum'.

            define condition >= 500000




South Sales is less than 5L, so it is filtered.





Top: We can filter the data by defining top n records. ( EX: Top 6 Cities sales wise, which is showed in the below picture)


Regular Filters - Measures: (Quantitative Filters) 

We can apply filters on measure fields by applying aggregation filters.



In this example, We select the Region wise Category whose sales between 1200000 & 230000.

1) Create a simple report with Region, Sub_Category & Sales fields

2) Drag Sales field onto Filters Shelf, then select 'Sum'.

3) Define range between 1200000 & 230000.





Date Filters:

We use this kind of filter to filter the Date Data. By using this kind of filter we can show Required Years, or Months or Quarters Data, (Jan-2015 or Yr-2015, Q1-2013.......)

Or We can show data for Specific range. (EX: From 1-Jan-2011 to 12-Sep-2013,.........)


EX 1: List the customers who made Transactions in Year - 2011


Steps:

In this example, We select the Year 2022,2021 Years data.

1) Create a simple report with Region, Order Date Updated & Sales fields

2) Drag Order Date Updated field onto Filters Shelf, then select 'Year'.

3) Select required Years, 2022,2021.






Tableau let's filter the Date Data in 2 Different ways.

1) Relative Date Filters.

2) Range Date Filters.



Relative Date Filters.

Relative date filters are dynamic, here values are changed as system date gets changed.(Operating System)


EX: Relative - Current Year 

Today Date #09-Mar-2023#


Description: Filters_Dim_Regular_Relative Dates:

In this example, We select the 2022 Data (Previous Year).

1) Create a simple report with Region, Order Date Updated & Sales fields

2) Drag Order Date Updated field onto Filters Shelf.

3) Select Relative Dates, then select 'Year', then select 'Previous Year'.



Years, Quarter, Months,........






EX: Today Date #09-Jul-2015#


Show me the Current Year Sales.

Today is #09-Jul-2015#, so it will show 2015 Data (including Future data also if database contains)


1) Drag [Region], [Order Date], [Customer Name] fields into the Rows shelf.


2) Drag one of the Measure fields from the Measures window into the Column Shelf.


3) Drag the [Order Date] into the Filters shelf, then it will be the list that contains Relative & Range Filters, here select Relative then click on Years, Then Click on "This Year" radio button.


4) As of now this report shows 2015 Data.


5) If you run the same report after 1 year, it will show 2016 Data. ( DB should have 2016 data rather than it will show an empty report).


EX: I want to show the current Month, Quarter, Last Quarter this Year, Last month this Year, .........


I want to see the last 3 Years of data on the Report. 


*********************

Range Date Filters.


These kinds of filters allow us to define the Static range dates.

And here we can't change date data, it means it is fixed Date filters.


EX: Today we have created a report for the year - 2012. If you run the same report next year, it will show YR-2011 data only, now we can say these filter values are fixed. ( Don't consider Parameter, Quick Filters in this scenario.)


EX:

1) Drag [Region], [Order Date], [Customer Name] fields into the Rows shelf.


2) Drag one of the Measure fields from the Measures window into the Column Shelf.


3) Drag the [Order Date] into the Filters shelf, then it will be the list that contains Range Filters, here select Range then Define Starting & Ending Dates.


4) As of now this report shows 2015 Data.


5) If you run the same report after 1 year, it will show 2016 Data. ( DB should have 2016 data rather than it will show an empty report).


*********************

Tableau offers filtering the data in different ways also, we can call these static filters.


1) Year wise, Month wise, Quarter wise, Week wise,............

2) Starting Date to Till end of the Date as per data in the DB.

3) Up to a certain Ending Date  from the starting Date.


*********************

Removing Nulls Data from the Report.

My data has nulls in Date Columns for Some Dates, i want to remove from the Report.


EX:

1) Drag [Region], [Order Date], [Customer Name] fields into the Rows shelf.


2) Drag one of the Measure fields from the Measures window into the Column Shelf.


3) Drag the [Order Date] into Filters shelf, then it will show the list that contains Range Filters, here select Relative then click on "Special", then click on "Non-null dates" option.


4) Now Report don't have the null Dates.



================================

EX:


1) I Want to see data for Current month only.

2) I want to see Sales Information from 1-Jan-2022 to Today.

3) I want to see data for Year 2021 & 22 & 23

4) What is the Orders Amount for the Current Quarter?

5) I want to see This year's March Month Data. ( without using Range Filter, Use alternative approach)

6) I want to See Previous Year Data. 



My data has nulls in Date Columns for Some Dates, I want to remove from the Report.

===================================================


Filters - Measures


We can filter the data on measures also by dragging the measure column & drop into filters shelf then click on "SUM" or any other Aggregate function then click on OK, then report will show filtered data.


And 


We can filter the Measures range specific or filtering Nulls, or showing only nulls..........



====================================


Quick Filters:


-> We use the Quick Filters to include or exclude the members from the report.


-> It offers more interaction with the report.It means End user can select the required data instantly.

If users don't want to see the data on the report, then they can deselect that specific member from Quick Filter.


EX:

1) Create a simple report with Region, Order Date Updated & Sales fields

2) Right click on the Sub-Category field then click on ‘Show Filter’.

3) Select required Years, 2022,2021.




Changing the UI:


1) Single Value (List):  This option offers to select only 1 member at a time or select all members by selecting "All" radio button.

It does not allow selecting multiple members from the selection criteria.


2) Single Value Drop Down List:

 This option also offers to select only 1 member at a time or select all members by selecting "All" radio button.

It does not allow selecting multiple members from the selection criteria.


3) Single Value Slide Bar:

This option also offers to select only 1 member at a time or select all members by selecting "All" radio button.

It does not allow selecting multiple members from the selection criteria.


4) Drop Down Multiple Values:

This option also offers select either at 1 or multiple members a time or select all members by selecting "All" checkbox.


5) Drop Down Multiple Values:

This option also offers select either at 1 or multiple members a time or select all members by selecting "All" checkbox.

Here List of the values shown in the drop down list.



6) Drop Down Multiple Values:

This option also offers select either at 1 or multiple members a time or select all members by selecting "All" checkbox.

Here List of the values shown in the drop down list.


7) Custom Value List:

This option also offers to select either at 1 or multiple members a time or select all members by typing the characters.


It will search the members which are related to your typed word.

If type ST, it will show the data EAST, WEST then select whichever members want to show on the report.

It is quite similar to Contains filter.



*****************

Similarly we can apply the Quick filters for Measures.


Quick Filters

Quick Filters are Prompts, which allows end users to select the required data, it increases user interactivity with reports.


Example:


  1. Right click on the Date field on the data window, click on “Show Quick Filter”.


 

  1. Now we get the Prompt, and we can select whichever we want to see on the report.



  1. For an Example, Select 2011, 2014. Rest of the year will be filtered.


 

Context Filters:


By default, all filters that you set in Tableau are computed independently. That is, each filter accesses all rows in your data source without regard to other filters. However, you can set one or more categorical filters as context filters for the view. You can think of a context filter as being an independent filter. Any other filters that you set are defined as dependent filters because they process only the data that passes through the context filter.


You may create a context filter to:

Improve performance – If you set a lot of filters or have a large data source, the queries can be slow. You can set one or more context filters to improve performance.

Create a dependent numerical or top N filter – You can set a context filter to include only the data of interest, and then set a numerical or a top N filter.


For example, suppose you’re in charge of breakfast products for a large grocery chain. Your task is to find the top 10 breakfast products by profitability for all stores. If the data source is very large, you can set a context filter to include only breakfast products. Then you can create a top 10 filter by profit as a dependent filter, which would process only the data that passes through the context filter.

Context filters are particularly useful for relational data sources because a temporary table is created. This table is automatically generated by Tableau when you set the context, and acts as a separate (smaller) data source that results in increased performance when you build data views.

Example of creating Context Filters:


  • Drag Field into Row shelf, Date onto Column shelf.


  • Drag Date field from data window to filters, and click on years, Select 2012, 2014.


  • Right click on the date field in the filter, click on “Add to Context”.


  • Once we convert Normal filters as Context filters, Filters color is changed from blue to black.



------------------- --------------------- -----------
What is show Relevant values in Tableau? (CASCADING FILTERS)


We use the show Relevant values to view associated values in quick filter, we can say it is CASCADING FILTER.

It means, State Quick Filter is showing Values as per values selected in "Region" quick filter.








========================================

Difference between Parameter & Quick filter
Definitions:
Quick Filters:
We use the Quick Filters to include or exclude the members from the report.

Parameters:
Parameters are dynamic variables that can be used as placeholders in formulas.
And we can replace constant value by dynamic value

Differences:
1) We can implement Quick Filters on "Rows" only, it means implement on "Records".
where as Parameters can be used on Rows or Columns for an instance we can select Measure Dynamically using Parameter.

2) We can select More than 1 value at a time
whereas Parameter allow us to pass max 1 Value at a time.

3) Parameter values not get updates automatically
whereas Quick filter will get update as database updates.

4) We can call Parameters into Calculations, where as we can't call Quick Filters into calculations.





No comments :

Post a Comment