{"id":14887,"date":"2023-12-21T15:52:30","date_gmt":"2023-12-21T10:22:30","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=14887"},"modified":"2023-12-21T16:14:25","modified_gmt":"2023-12-21T10:44:25","slug":"logical-functions-in-tableau","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/logical-functions-in-tableau\/","title":{"rendered":"Logical Functions in Tableau"},"content":{"rendered":"\n<p>We will study logical functions and how Tableau uses them in this article. For now, consider the following two terms:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Tableau<\/strong>: For the purpose of visualising data and obtaining a definitive opinion based on data analysis, data analysts, scientists, statisticians, and other professionals can utilise this incredibly potent data visualisation application. Tableau is well-known for its ability to quickly process data and generate the necessary data visualisation output.<\/li>\n\n\n\n<li><strong>Logical Function<\/strong>: To carry out logical operations on our data, Tableau offers a number of Logical Functions. Tableau AND, NOT, OR, IF, ELSEIF, IF Else, CASE, ISNULL, IFNULL, ZN, IIF, and so on are examples of them.<\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s go over each logical function with an example one by one. The dataset utilised in the examples provided is Dataset. Check out the <a href=\"https:\/\/www.h2kinfosys.com\/courses\/tableau-online-training-course-details\/\">online Tableau course<\/a> to learn more.<\/p>\n\n\n\n<p><strong>AND Function:<\/strong> To view several expressions, use the AND function. The AND Function&#8217;s syntax is as follows:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Expression_1 AND Expression_2<\/strong><\/h2>\n\n\n\n<p>It returns True if both of the conditions are met. If not, False is returned.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/qUt9zteeD3B58LiScQDQHH-BRIoW0ejLC_fECRjhcP8SRljSkrDjlzO15-_IqrPlBgDxFUq-dX8K_nbSrkRm2VkeyHSvazQUpq50doX55Gqq7J0mZP2cXK_X-17UdQ9BtZcH2ADr1EiXtECE9Sosow\" alt=\"\" title=\"\"><\/figure>\n\n\n\n<p><strong>OR Function<\/strong>: Tableau&#8217;s OR function is comparable to an English either-or expression. Tableau returns False if both conditions are false; it returns True otherwise. This Tableau OR Function has the following syntax:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Expression_1 OR Expression_2<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<p><strong>IIF Function<\/strong>: The If Else Function in Tableau is simplified to become the IIF function. It will return the first statement if both conditions are true; else, it will return the second statement. This Tableau IF Function has the following syntax:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IIF(Expression, True_statement, False_Statement)<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<p><strong>NOT Function<\/strong>: The exact opposite is returned by the Tableau NOT function. True will turn into false, and vice versa. This Tableau NOT Function has the following syntax:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>NOT(Expression)<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<p><strong>ISNULL Function<\/strong>: Tableau&#8217;s ISNULL function will determine if a given value is NULL or not. It returns TRUE if it&#8217;s NULL; else, False is returned. The Tableau ISNULL Function has the following syntax:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>ISNULL(Expression)<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<p><strong>ZN Function<\/strong>: The Tableau ZN function returns 0 for null values and the first values of not-null values. To put things simply, ZN is used in <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tableau_Software\" rel=\"nofollow noopener\" target=\"_blank\">Tableau<\/a> to replace NULL values with 0. The Tableau ZN Function has the following syntax:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>ZN(Expression)<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<p><strong>IFNULL Function<\/strong>: You can use Tableau&#8217;s IFNULL function to swap out NULL values for your own. The Tableau IFNULL Function has the following syntax:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IFNULL(Expression, Value)<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/zrXpel8F-DL5f0ftrBUc0c5vXGe0NrhCrJ-JMwHmwILcVOSt6H9iC8Fn4oDhJXQC25pAujrLM8N-hxXEOVPQ7mjCzA18kWt3mQ_Hfkd6-bb_1EOj6IRB1Iq8dEsUFvCboo0BQduecouFs_5EN2qDhQ\" alt=\"Logical Functions in Tableau\" title=\"\"><\/figure>\n\n\n\n<p><strong>IF Function<\/strong>: In Tableau, one of the most important and practical decision-making functions is the IF Function. The function will return the output if it tests the condition and returns the outcome based on the condition.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IF-END<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In this example, we just use the IF function on a field to generate a new calculated field.<\/li>\n\n\n\n<li>View the newly computed field.<\/li>\n\n\n\n<li>Apply to Visualization.<\/li>\n\n\n\n<li>One of its drawbacks is that if the condition is false, null values are produced.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IF-ELSE-END<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In this case, we just use the IF-ELSE function in the same field to update the previously calculated field.<\/li>\n\n\n\n<li>Examine a freshly computed field.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Apply to Visualization.<\/li>\n\n\n\n<li>It resolves a flaw that, in the event of a false condition, produces null values.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IF-ELSEIF-ELSE-END<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In this example, we only use the IF-ELSEIF-ELSE function on a field to generate a new calculated field.<\/li>\n\n\n\n<li>Examine a freshly computed field.<\/li>\n\n\n\n<li>Apply to Visualization.<\/li>\n<\/ul>\n\n\n\n<p><strong>Case Function<\/strong>: In Tableau, Case Function is a subset of Logical functions. When the test expression is true, these functions are used to carry out the logical test and return the necessary value.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We must utilise Calculated Fields in Tableau to illustrate this logical function.<\/li>\n\n\n\n<li>Please select the Create Calculated Field&#8230; option from the Analysis Tab after navigating there to create a calculated field.<\/li>\n\n\n\n<li>In the newly created field, apply the expression.<\/li>\n<\/ul>\n\n\n\n<p><strong>Conclusion<\/strong>&nbsp;To learn more about Logical Functions in Tableau,&nbsp; check out the <a href=\"https:\/\/www.h2kinfosys.com\/courses\/tableau-online-training-course-details\/\">Tableau online training<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Logical Functions in Tableau<\/p>\n","protected":false},"author":1,"featured_media":14893,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[804],"tags":[],"class_list":["post-14887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tableau-tutorials"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/14887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=14887"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/14887\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/14893"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=14887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=14887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=14887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}