{"id":1851,"date":"2026-09-01T12:35:25","date_gmt":"2026-09-01T12:35:25","guid":{"rendered":"https:\/\/entri.app\/explore\/?post_type=curriculum&#038;p=1851"},"modified":"2026-09-10T12:17:24","modified_gmt":"2026-09-10T12:17:24","slug":"dax-logical-functions","status":"publish","type":"curriculum","link":"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/","title":{"rendered":"DAX Logical Functions"},"content":{"rendered":"<h2><strong><b>What Are Logical Functions in DAX?<\/b><\/strong><\/h2>\n<p>Logical functions in DAX \u2014 IF(), AND(), OR(), and SWITCH() \u2014 return values based on conditions, letting a measure or calculated column change its result depending on whether a test is true or false.<\/p>\n<h2><strong><b>Common DAX Logical Functions<\/b><\/strong><\/h2>\n<ul>\n<li><b><\/b><strong><b>IF(): <\/b><\/strong>returns one value if a condition is true and another if it&#8217;s false.<\/li>\n<li><b><\/b><strong><b>AND(): <\/b><\/strong>returns true only if both supplied conditions are true.<\/li>\n<li><b><\/b><strong><b>OR(): <\/b><\/strong>returns true if at least one of the supplied conditions is true.<\/li>\n<li><b><\/b><strong><b>SWITCH(): <\/b><\/strong>evaluates an expression against a list of possible values and returns the matching result, similar to a multi-branch IF.<\/li>\n<\/ul>\n<h2><strong><b>When to Use SWITCH Instead of Nested IF<\/b><\/strong><\/h2>\n<p>Nesting several IF() functions inside each other quickly becomes hard to read and debug. SWITCH() flattens the same logic into a single, linear list of conditions and results, which is generally easier to maintain once there are more than two or three branches.<\/p>\n<h2><strong><b>How to Use IF and SWITCH in a DAX Measure<\/b><\/strong><\/h2>\n<p>This tutorial builds a conditional DAX measure two ways \u2014 first with IF(), then rewritten with SWITCH() \u2014 in about 5 steps, so you can see when each is the better fit.<\/p>\n<h3><strong><b>Prerequisites<\/b><\/strong><\/h3>\n<ul>\n<li>Power BI Desktop with a table containing a category-style column<\/li>\n<li>A basic measure already in place<\/li>\n<\/ul>\n<h3><strong><b>Steps<\/b><\/strong><\/h3>\n<ul>\n<li><b><\/b><strong><b> Write a simple IF() measure: <\/b><\/strong>Sales Flag = IF([Total Sales] &gt; 10000, &#8220;High&#8221;, &#8220;Low&#8221;).<\/li>\n<li><b><\/b><strong><b> Add a second condition with AND(): <\/b><\/strong>IF(AND([Total Sales] &gt; 10000, Sales[Region] = &#8220;West&#8221;), &#8220;High West&#8221;, &#8220;Other&#8221;).<\/li>\n<li><b><\/b><strong><b> Rewrite the same logic with SWITCH(): <\/b><\/strong>SWITCH(TRUE(), [Total Sales] &gt; 10000, &#8220;High&#8221;, [Total Sales] &gt; 5000, &#8220;Medium&#8221;, &#8220;Low&#8221;).<\/li>\n<li><b><\/b><strong><b> Compare readability: <\/b><\/strong>Notice how SWITCH(TRUE(), &#8230;) reads as a flat list of conditions rather than nested parentheses.<\/li>\n<li><b><\/b><strong><b> Test both versions: <\/b><\/strong>Add each measure to a table visual and confirm they return matching results.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>What Are Logical Functions in DAX? Logical functions in DAX \u2014 IF(), AND(), OR(), and SWITCH() \u2014 return values based on conditions, letting a measure or calculated column change its result depending on whether a test is true or false. Common DAX Logical Functions IF(): returns one value if a condition is true and another [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"template":"","meta":{"_acf_changed":false},"curriculum-category":[101,91],"custom_linking_tags":[120],"class_list":["post-1851","curriculum","type-curriculum","status-publish","hentry","curriculum-category-power-bi-dax","curriculum-category-power-bi-tutorials","custom_linking_tags-dax-logical-functions"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>DAX Logical Functions - Entri Free Materials<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DAX Logical Functions - Entri Free Materials\" \/>\n<meta property=\"og:description\" content=\"What Are Logical Functions in DAX? Logical functions in DAX \u2014 IF(), AND(), OR(), and SWITCH() \u2014 return values based on conditions, letting a measure or calculated column change its result depending on whether a test is true or false. Common DAX Logical Functions IF(): returns one value if a condition is true and another [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Free Materials\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-10T12:17:24+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/\",\"url\":\"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/\",\"name\":\"DAX Logical Functions - Entri Free Materials\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/explore\/#website\"},\"datePublished\":\"2026-09-01T12:35:25+00:00\",\"dateModified\":\"2026-09-10T12:17:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/explore\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DAX Logical Functions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/explore\/#website\",\"url\":\"https:\/\/entri.app\/explore\/\",\"name\":\"Entri Free Materials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/explore\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/explore\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/explore\/#organization\",\"name\":\"Entri Free Materials\",\"url\":\"https:\/\/entri.app\/explore\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/explore\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/wp-cdn.entri.app\/explore\/2025\/03\/logo.svg\",\"contentUrl\":\"https:\/\/wp-cdn.entri.app\/explore\/2025\/03\/logo.svg\",\"caption\":\"Entri Free Materials\"},\"image\":{\"@id\":\"https:\/\/entri.app\/explore\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DAX Logical Functions - Entri Free Materials","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/","og_locale":"en_US","og_type":"article","og_title":"DAX Logical Functions - Entri Free Materials","og_description":"What Are Logical Functions in DAX? Logical functions in DAX \u2014 IF(), AND(), OR(), and SWITCH() \u2014 return values based on conditions, letting a measure or calculated column change its result depending on whether a test is true or false. Common DAX Logical Functions IF(): returns one value if a condition is true and another [&hellip;]","og_url":"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/","og_site_name":"Entri Free Materials","article_modified_time":"2026-09-10T12:17:24+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/","url":"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/","name":"DAX Logical Functions - Entri Free Materials","isPartOf":{"@id":"https:\/\/entri.app\/explore\/#website"},"datePublished":"2026-09-01T12:35:25+00:00","dateModified":"2026-09-10T12:17:24+00:00","breadcrumb":{"@id":"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/explore\/power-bi\/dax-logical-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/explore\/"},{"@type":"ListItem","position":2,"name":"DAX Logical Functions"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/explore\/#website","url":"https:\/\/entri.app\/explore\/","name":"Entri Free Materials","description":"","publisher":{"@id":"https:\/\/entri.app\/explore\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/explore\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/explore\/#organization","name":"Entri Free Materials","url":"https:\/\/entri.app\/explore\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/explore\/#\/schema\/logo\/image\/","url":"https:\/\/wp-cdn.entri.app\/explore\/2025\/03\/logo.svg","contentUrl":"https:\/\/wp-cdn.entri.app\/explore\/2025\/03\/logo.svg","caption":"Entri Free Materials"},"image":{"@id":"https:\/\/entri.app\/explore\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/explore\/wp-json\/wp\/v2\/curriculum\/1851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/explore\/wp-json\/wp\/v2\/curriculum"}],"about":[{"href":"https:\/\/entri.app\/explore\/wp-json\/wp\/v2\/types\/curriculum"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/explore\/wp-json\/wp\/v2\/users\/2"}],"wp:attachment":[{"href":"https:\/\/entri.app\/explore\/wp-json\/wp\/v2\/media?parent=1851"}],"wp:term":[{"taxonomy":"curriculum-category","embeddable":true,"href":"https:\/\/entri.app\/explore\/wp-json\/wp\/v2\/curriculum-category?post=1851"},{"taxonomy":"custom_linking_tags","embeddable":true,"href":"https:\/\/entri.app\/explore\/wp-json\/wp\/v2\/custom_linking_tags?post=1851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}