How to Convert Yes/No to 1/0 in Power BI

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

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.

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

Let’s get started.

Using the IF Function

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.

After this, go to the Modeling tab and click on New Column.

In the formula bar, enter the following formula:

Column = IF(Sheet1[Type] = "Yes", 1, 0)
how to convert yes/no to 1/0 - monocroft

Where Column stands for the name of the new column that will be created.

And Sheet1[Type] is the name of the column where my Yes/No value is stored in the dataset.

Then press Enter to create the new column. This will convert the Yes/No values to 1 and 0, respectively in a new column.

(As displayed below when you click on the data tab)

how to convert yes/no to 1/0 - monocroft

Using the SWITCH function

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

Column = SWITCH(Sheet1[Type],  "Yes", 1, "No", 0)

Where Column stands for the name of the new column that will be created.

And Sheet1[Type] is the name of the column where the new Yes/No value is stored in the dataset.

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

how to convert yesno to 10 - monocroft

Conclusion: How to Convert Yes/No to 1/0 in Power BI

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.

Also, you can rename the column to something more meaningful instead of the default name.

NB: You can also use the Replace Values 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, select Edit Queries, and then select Replace Values.

I hope you understood these steps.

Thanks for reading!