{"id":1683,"date":"2023-01-20T19:02:28","date_gmt":"2023-01-20T19:02:28","guid":{"rendered":"https:\/\/monocroft.com\/?p=1683"},"modified":"2023-03-03T08:31:50","modified_gmt":"2023-03-03T08:31:50","slug":"how-to-convert-yesno-to-1-0","status":"publish","type":"post","link":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/","title":{"rendered":"How to Convert Yes\/No to 1\/0 in Power BI"},"content":{"rendered":"\n

In Power BI, there are different ways to convert Yes\/No<\/strong> values to 1\/0<\/strong> using various functions such as the SWITCH<\/strong>, or IF functions<\/strong>. <\/p>\n\n\n\n

Regardless of the method you choose, you will need to create a new column in your table to hold the converted values. And once the new column is created, you can make use of it in your visualizations and reports.<\/p>\n\n\n\n

In this article, I will explain some of these methods to convert Yes\/No to 1\/0 <\/strong>when working with Power BI.<\/p>\n\n\n\n

Let’s get started.<\/p>\n\n\n\n

Using the IF Function<\/h2>\n\n\n\n

To use the IF function, make sure you already have your data inserted into Power BI Desktop. Then select the dataset that contains the Yes\/No column.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

After this, go to the Modeling<\/strong> tab<\/strong> and click on New Column<\/strong>.<\/p>\n\n\n\n

In the formula bar, enter the following formula:<\/p>\n\n\n\n

Column = IF(Sheet1[Type] = \"Yes\", 1, 0)<\/strong><\/code><\/pre>\n\n\n\n
\"how<\/figure>\n\n\n\n

Where Column<\/strong> <\/code>stands for the name of the new column that will be created.<\/em><\/p>\n\n\n\n

And Sheet1[Type]<\/strong><\/code> is the name of the column where my Yes\/No<\/strong> value is stored in the dataset.<\/em><\/p>\n\n\n\n

Then press Enter <\/strong>to create the new column. This will convert the Yes\/No values to 1 and 0, respectively in a new column.<\/p>\n\n\n\n

(As displayed below when you click on the data<\/strong> tab)<\/em><\/p>\n\n\n\n

\"how<\/figure>\n\n\n\n

Using the SWITCH function<\/h2>\n\n\n\n

Also, you can as well use the SWITCH function to convert Yes\/No to 1\/0 by using this formula:<\/p>\n\n\n\n

Column = SWITCH(Sheet1[Type],  \"Yes\", 1, \"No\", 0)<\/code><\/strong><\/pre>\n\n\n\n

Where Column<\/strong> stands for the name of the new column that will be created.<\/em><\/p>\n\n\n\n

And Sheet1[Type]<\/strong><\/code> is the name of the column where the new Yes\/No<\/strong> value is stored in the dataset.<\/em><\/p>\n\n\n\n

Save the changes and you are done! The new column will now contain only 1’s and 0’s<\/strong>, and you can see this in the data tab (as displayed below).<\/em><\/p>\n\n\n\n

\"how<\/figure>\n\n\n\n

Conclusion: How to Convert Yes\/No to 1\/0 in Power BI<\/h2>\n\n\n\n

Finally, always keep in mind that regardless of the method you choose to use, you will create a new column in your table to hold the converted values. And once the new column is created, you can use it in your visualizations and reports.<\/p>\n\n\n\n

Also, you can rename the column to something more meaningful instead of the default name.<\/p>\n\n\n\n

NB: You can also use the Replace Values<\/strong> in Power Query Editor to replace Yes with 1 and No with 0 if you have a large number of rows. To do this, go to the Home tab<\/strong>, select Edit Queries<\/strong>, and then select Replace Values<\/strong>.<\/em><\/p>\n\n\n\n

I hope you understood these steps.<\/p>\n\n\n\n

Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"

In Power BI, there are different ways to convert Yes\/No values to 1\/0 using various functions such as the SWITCH, … <\/p>\n

Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":1685,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,8],"tags":[],"yoast_head":"\nHow to Convert Yes\/No to 1\/0 in Power BI - Monocroft<\/title>\n<meta name=\"description\" content=\"Want to learn how to convert yes\/no to 1\/0 in power bi? This article explains a step-by-step guide on how to do that. Read to find out.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Convert Yes\/No to 1\/0 in Power BI - Monocroft\" \/>\n<meta property=\"og:description\" content=\"Want to learn how to convert yes\/no to 1\/0 in power bi? This article explains a step-by-step guide on how to do that. Read to find out.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/\" \/>\n<meta property=\"og:site_name\" content=\"Monocroft\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-20T19:02:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-03T08:31:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"405\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Matt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/\"},\"author\":{\"name\":\"Matt\",\"@id\":\"https:\/\/monocroft.com\/#\/schema\/person\/3aeab97c9b5661d211c0742c48f024b3\"},\"headline\":\"How to Convert Yes\/No to 1\/0 in Power BI\",\"datePublished\":\"2023-01-20T19:02:28+00:00\",\"dateModified\":\"2023-03-03T08:31:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/\"},\"wordCount\":413,\"publisher\":{\"@id\":\"https:\/\/monocroft.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg\",\"articleSection\":[\"Guides\",\"PowerBI\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/\",\"url\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/\",\"name\":\"How to Convert Yes\/No to 1\/0 in Power BI - Monocroft\",\"isPartOf\":{\"@id\":\"https:\/\/monocroft.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg\",\"datePublished\":\"2023-01-20T19:02:28+00:00\",\"dateModified\":\"2023-03-03T08:31:50+00:00\",\"description\":\"Want to learn how to convert yes\/no to 1\/0 in power bi? This article explains a step-by-step guide on how to do that. Read to find out.\",\"breadcrumb\":{\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage\",\"url\":\"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg\",\"contentUrl\":\"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg\",\"width\":720,\"height\":405,\"caption\":\"how to convert yes\/no to 1\/0 - monocroft\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/monocroft.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Convert Yes\/No to 1\/0 in Power BI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/monocroft.com\/#website\",\"url\":\"https:\/\/monocroft.com\/\",\"name\":\"Monocroft\",\"description\":\"Monocroft Tech\",\"publisher\":{\"@id\":\"https:\/\/monocroft.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/monocroft.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/monocroft.com\/#organization\",\"name\":\"Triburge\",\"url\":\"https:\/\/monocroft.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/monocroft.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/07\/monocroft-logo.png\",\"contentUrl\":\"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/07\/monocroft-logo.png\",\"width\":512,\"height\":512,\"caption\":\"Triburge\"},\"image\":{\"@id\":\"https:\/\/monocroft.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/monocroft.com\/#\/schema\/person\/3aeab97c9b5661d211c0742c48f024b3\",\"name\":\"Matt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/monocroft.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c06bcee4d38a649222493c5e9f11f7a5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c06bcee4d38a649222493c5e9f11f7a5?s=96&d=mm&r=g\",\"caption\":\"Matt\"},\"url\":\"https:\/\/monocroft.com\/author\/matthew\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Convert Yes\/No to 1\/0 in Power BI - Monocroft","description":"Want to learn how to convert yes\/no to 1\/0 in power bi? This article explains a step-by-step guide on how to do that. Read to find out.","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:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/","og_locale":"en_US","og_type":"article","og_title":"How to Convert Yes\/No to 1\/0 in Power BI - Monocroft","og_description":"Want to learn how to convert yes\/no to 1\/0 in power bi? This article explains a step-by-step guide on how to do that. Read to find out.","og_url":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/","og_site_name":"Monocroft","article_published_time":"2023-01-20T19:02:28+00:00","article_modified_time":"2023-03-03T08:31:50+00:00","og_image":[{"width":720,"height":405,"url":"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg","type":"image\/jpeg"}],"author":"Matt","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Matt","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#article","isPartOf":{"@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/"},"author":{"name":"Matt","@id":"https:\/\/monocroft.com\/#\/schema\/person\/3aeab97c9b5661d211c0742c48f024b3"},"headline":"How to Convert Yes\/No to 1\/0 in Power BI","datePublished":"2023-01-20T19:02:28+00:00","dateModified":"2023-03-03T08:31:50+00:00","mainEntityOfPage":{"@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/"},"wordCount":413,"publisher":{"@id":"https:\/\/monocroft.com\/#organization"},"image":{"@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage"},"thumbnailUrl":"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg","articleSection":["Guides","PowerBI"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/","url":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/","name":"How to Convert Yes\/No to 1\/0 in Power BI - Monocroft","isPartOf":{"@id":"https:\/\/monocroft.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage"},"image":{"@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage"},"thumbnailUrl":"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg","datePublished":"2023-01-20T19:02:28+00:00","dateModified":"2023-03-03T08:31:50+00:00","description":"Want to learn how to convert yes\/no to 1\/0 in power bi? This article explains a step-by-step guide on how to do that. Read to find out.","breadcrumb":{"@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#primaryimage","url":"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg","contentUrl":"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/01\/how-to-convert-yesno-to-10-monocroft.jpg","width":720,"height":405,"caption":"how to convert yes\/no to 1\/0 - monocroft"},{"@type":"BreadcrumbList","@id":"https:\/\/monocroft.com\/how-to-convert-yesno-to-1-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/monocroft.com\/"},{"@type":"ListItem","position":2,"name":"How to Convert Yes\/No to 1\/0 in Power BI"}]},{"@type":"WebSite","@id":"https:\/\/monocroft.com\/#website","url":"https:\/\/monocroft.com\/","name":"Monocroft","description":"Monocroft Tech","publisher":{"@id":"https:\/\/monocroft.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/monocroft.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/monocroft.com\/#organization","name":"Triburge","url":"https:\/\/monocroft.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/monocroft.com\/#\/schema\/logo\/image\/","url":"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/07\/monocroft-logo.png","contentUrl":"https:\/\/monocroft.com\/wp-content\/uploads\/2023\/07\/monocroft-logo.png","width":512,"height":512,"caption":"Triburge"},"image":{"@id":"https:\/\/monocroft.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/monocroft.com\/#\/schema\/person\/3aeab97c9b5661d211c0742c48f024b3","name":"Matt","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/monocroft.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c06bcee4d38a649222493c5e9f11f7a5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c06bcee4d38a649222493c5e9f11f7a5?s=96&d=mm&r=g","caption":"Matt"},"url":"https:\/\/monocroft.com\/author\/matthew\/"}]}},"_links":{"self":[{"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/posts\/1683"}],"collection":[{"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/comments?post=1683"}],"version-history":[{"count":43,"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/posts\/1683\/revisions"}],"predecessor-version":[{"id":4103,"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/posts\/1683\/revisions\/4103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/media\/1685"}],"wp:attachment":[{"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/media?parent=1683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/categories?post=1683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monocroft.com\/wp-json\/wp\/v2\/tags?post=1683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}