EDUCBA

EDUCBA

MENUMENU
  • Blog
  • Free Courses
  • All Courses
  • All in One Bundle
  • Login
Home Data Science Data Science Tutorials Tableau Tutorial Tableau Window Functions

Tableau Window Functions

Priya Pedamkar
Article byPriya Pedamkar

Updated March 24, 2023

Tableau Window Functions

Introduction to Tableau Window Functions

Tableau’s versatility as a BI tool is proven by many of its capabilities. One such capability is the functionality of Windows functions. Windows functions are those functions that allow us flexibility while working with data calculations. What these functions do is similar to the operations performed by the OFFSET function in Excel. These functions truly enhance Tableau’s capability as a BI tool. Though they work along similar lines, in order to understand the application of Windows functions, each of them must be experimented in different contexts.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Working with Window Functions in Tableau

1. First load the dataset. For that click on “New Data Source” under Data Menu as shown below.

Tableau Window Functions 1

2. In the Connect section select the requisite data source type. In this case, it is clicked on “MS Excel”, so click on “Microsoft Excel” as shown below.

Tableau Window Functions 2

3. Select the requisite Excel file from the location it is stored at and open it to load into Tableau as illustrated below.

Tableau Window Functions 3

4. When the above steps are followed properly, the data gets loaded into Tableau and can be seen in the Data tab.

Tableau Window Functions 4

5. The requisite dimensions and measures in the dataset can be seen in the respective sections. This is as shown below.

Tableau Window Functions 6

6. To begin with, bring region dimension into Rows region and drag ‘Sales in Million’ measure over Text in marks card. We get a table giving region-wise sales as can be seen in the below image.

Tableau Window Functions 7

7. In order to demonstrate the application of Windows functions, we first need to create a calculated field. Now, right-click anywhere in the blank space under the Data tab. In the pop-menu, click on “Create Calculated Field” as illustrated in the following image.

Tableau Window Functions 8

8. When we follow the above step, we are navigated to the calculated field pane, as shown below.

Tableau Window Functions 8

9. Click on the arrow in the calculated field pane, it takes us to all the available functions in Tableau. Scroll down to discover all the available Windows functions. The following image highlights the windows functions available in Tableau. Click on any of the Windows functions to know more about it.

Tableau Window Functions 9

10. Selecting a particular function gives its information in detail. As can be seen in the below image, when we select the WINDOW_SUM function, Tableau gives us complete detail about the function.

Tableau Window Functions 10

11. We shall employ this function and understand its use. Double click on it and it is brought into the calculated field pane as can be seen in the following image. As we can see, this function essentially takes three arguments viz. expression, start and end. “expression” refers to any mathematical expression that we want to pass. The start and end parameters are what basically makes the windows function differently than normal functions. They allow us to select the requisite portion of data in a column. We shall understand the use of these parameters in detail in the coming part. Observe the following image carefully.

Tableau Window Functions 11

12. For the expression argument, we passed the SUM(Sales in Million) function. The Window functions take aggregate functions as arguments and work on them.

Tableau Window Functions 12

13. Let’s name the above-calculated field as “Applied_Total”, and click on Apply and then on OK. We can find the newly created calculated field in the measures section as highlighted in green. We shall bring it into analysis.

img 13

14. We brought it into the analysis as can be seen in the following image. What we can see is that we got total sales for all the regions, because we had embedded SUM function in WINDOW_SUM function.

img14

15. Now, we want total sales except that of the Central region. We can exclude the sales of the Central region using the WINDOW_SUM function. Closely observe the implementation as shown below. Now, we passed the start and end parameters. Here FIRST() and LAST() functions have been used. They do nothing but give the first and last position in the column. FIRST() + 1 means that sum operations will start from the second row i.e. from the row containing data for East region. LAST() means the calculation will happen till the end. So, we get total sales excluding that of the Central region.

img 15

16. Once done, click on Apply and then on Ok. Bring the updated Applied_Total calculated field into the analysis, and we get the figures as shown below.

img16

17. Now, we are interested in comparing the sales for the five regions with the average of the sales of the regions of North and South. Here, we shall be using the WINDOW_AVG function provided by Tableau. The implementation of the function is as shown in the following screenshot. Observer the start and the end parameters. We have moved two places down from above and one place up from below to get the sales average for the North and South regions only. Once done, apply the calculation and save the calculated field.

img17

18. Once the field is updated as described above, bring it into the analysis, and we get the required average figure. The following image shows this. Now, we can compare the sales of each region with that of the average sales of North and South.

img18

19. The following image shows the application of WINDOW_MAX function using the same process that we discussed in the preceding section. Here, we got the maximum sales from amongst East, North and South regions.

img19

20. Just observe the following image closely. We implemented the WINDOW_MEDIAN function. The median function gives us the middle value. Observe the start and the end parameters. We chose to have a median for the East and North regions. We should cross verify the results with manual calculations to validate that the function has worked correctly. The way these Windows functions have been implemented, in a similar way all other Windows functions can be implemented. However, it is always good to have knowledge of the concept before the implementation.

img 20

Conclusion

Window functions are just variants of the normal forms of these functions. Tableau by providing us Window functions makes things easier for us especially in situations that involve working with a select portion of data. These functions must be worked with various examples to understand them properly.

Recommended Articles

This is a guide to Tableau Window Functions. Here we discuss the introduction and how does window functions work in tableau with its detailed explanation. You may also look at the following articles to learn more –

  1. Hierarchy in Tableau
  2. Group in Tableau
  3. Tableau Versions
  4. Tableau Dynamic Parameters
  5. Guide to Max Function in Python
WINDOWS POWERSHELL Course Bundle - 7 Courses in 1
19+ Hours of HD Videos
7 Courses
Verifiable Certificate of Completion
Lifetime Access
4.5
SALESFORCE Course Bundle - 4 Courses in 1
24+ Hours of HD Videos
4 Courses
Verifiable Certificate of Completion
Lifetime Access
4.5
MINITAB Course Bundle - 9 Courses in 1 | 2 Mock Tests
35+ Hour of HD Videos
9 Courses
2 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
SAS PROGRAMMING Course Bundle - 18 Courses in 1 | 8 Mock Tests
123+ Hours of HD Videos
18 Courses
8 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
Primary Sidebar
Popular Course in this category
TABLEAU Course Bundle - 16 Courses in 1 | 2 Mock Tests
 54+ Hour of HD Videos
16 Courses
2 Mock Tests & Quizzes
  Verifiable Certificate of Completion
  Lifetime Access
4.5
Price

View Course
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more