Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Is it possible to enter Boolean values in Text data type column? If yes, How?

Hi,

 

When i enter as TRUE/FALSE or True/False in Text data type column it is considered as String which is leading to incorrect output. Is it possible to enter Boolean values in Text data type column? If yes, How?

 

@systemadmindemo 

@amitchandak 

@Greg_Deckler 

1 ACCEPTED SOLUTION

@RamaKrishna8989 This is merely showing you what the results are for each individual event if it were its own column.  It's not saying that the outcome of mixed formatted records in a column would automatically calculate the specific output as it is listed in that table. Below is an example of what I mean:

 

1. The column True/False is boolean structured. Therefore TRUE = 1 and FALSE = 0.

2. The column 1/0 has a blank, a zero and ones.  The output is the Measure 1/0s which aligns to the AVERAGEA output.  

 

TheoC_0-1668813208471.png

 

Hope this makes sense.

 

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

10 REPLIES 10
TheoC
Super User
Super User

Hi @RamaKrishna8989 yes, this can certainly be done.  Just add " " at the start and end of the condition to determine whether the condition you're putting forward is TRUE/FALSE.

 

If I've misunderstood your question, please feel free to add an example of what you're referring to.

 

Thanks,
Theo

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC 

RamaKrishna8989_0-1668736638946.png

 

Here, TRUE and FALSE are considered as Text, i want them to be considered as Boolean so my calculation happens correctly.

 

 

@TheoC, If i am modifying values if working as expected. However, i am trying to replicate something like the below example. 

 

RamaKrishna8989_0-1668738634329.png

Here, the Amount column has "TRUE" boolean value for Transaction id = 0000126. How is this considered as a boolean value to result in the value as "1"

@RamaKrishna8989 with the example you've provided, you can use conditional statements such as IF or SWITCH TRUE to achieve what you are after. For example, you can create a Calculated Column and use the below:

 

Calculated Column = 

SWITCH ( 
     TRUE()
         'Table'[Amount] = "1" , 1 ,
         'Table'[Amount] = "20" , 20 ,
         'Table'[Amount] = "n/a" , 0 ,
         'Table'[Amount] = "" , 0 ,
         'Table'[Amount] = "TRUE" , 1 )

 

The above is aligned to the example image you provided and you can switch the "Amount" column to "Col1" to meet your version from the original post.

 

Let me know if that makes sense?

 

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC, but the above calculated column is all done with just averagea function as shown in the screenshot. Wondering how was that possible.

 

RamaKrishna8989_0-1668749217416.png

 

 

 

@RamaKrishna8989 This is merely showing you what the results are for each individual event if it were its own column.  It's not saying that the outcome of mixed formatted records in a column would automatically calculate the specific output as it is listed in that table. Below is an example of what I mean:

 

1. The column True/False is boolean structured. Therefore TRUE = 1 and FALSE = 0.

2. The column 1/0 has a blank, a zero and ones.  The output is the Measure 1/0s which aligns to the AVERAGEA output.  

 

TheoC_0-1668813208471.png

 

Hope this makes sense.

 

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@RamaKrishna8989 please send link.

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@RamaKrishna8989 If your source data contains Col 1 and the source data has 1, FALSE, One, TRUE, then you will need to modify the data in Col 1 in the raw source file.

 

The boolean output should be based on a condition being met or not being met.  For example:

 

TheoC_0-1668738154684.png

 

I hope this makes sense?

 

Thanks heaps

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@RamaKrishna8989 In addition to the above, your entire Col1 should be TRUE or FALSE if you are wanting it to be treated as such.  Once you do that, you can go into Power Query by pressing "Transform Data" and then simply click the "abc" on the column like below:

 

TheoC_1-1668738439427.png

 

Once you've done that you can click on "TRUE/FALSE"

 

TheoC_2-1668738474405.png

 

This will convert the column to a boolean like below:

 

TheoC_3-1668738584230.png

 

Hope this is what you're wanting.

 

Theo 🙂

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors