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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
OleMcDonald
Helper I
Helper I

Power Query Create Column Syntax

I'm trying to get to..

I am trying to create a Treu/False column with this logic

If [Is Target] is true then True
or else if
If [AccountTypeGroup] =Client then True
or else if
[AnnualRevenue] >= 250000000 and [Has Products] = "True" and [Marketing Country] = "True" then True
else False

I dont think my syntax is right

 

if [AccountTypeGroup] = "Client" then true else if [Is Target] = "True" then true else if [AnnualRevenue] >= 250000000 and [Has Products] = "True" and [Marketing Country] = "True" then true else false
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @OleMcDonald 

Download an example PBIX file with the below code in it.

 

If you could supply your actual data it would help becaue it's not clear if your true/false values are Boolean true/false or if you are using text strings.

If you are using Boolean True/False then your data would look like this

boolean-table.png

and you would use this query to create a Custom Column

 

if [AccountTypeGroup] = "Client" or [Is Target] = true 

then true 

else if [AnnualRevenue] >= 250000000 and [Has Products] = true and [Marketing Country] = true

then true 

else false

 

 

If you are using text columns for True/False you're data will look something like this (notice the icons in the column headers are different for True/False compared to the Boolean columns above)

table-text.png

Using text adds another complication in that the text string True is not the same as the text string true, but you could use a query like this

 

if [AccountTypeGroup] = "Client" or [Is Target] = "True" 

then true 

else if [AnnualRevenue] >= 250000000 and [Has Products] = "True" and [Marketing Country] = "True" 

then true 

else false

 

 

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
OleMcDonald
Helper I
Helper I

All of your replies were extermely helpful. Thank you all for taking the time to help.

I didnt know "True" and true were not the same. So, I went back and edited the columns I created to true / false rather than "True" / "False".

Thanks again

PhilipTreacy
Super User
Super User

Hi @OleMcDonald 

Download an example PBIX file with the below code in it.

 

If you could supply your actual data it would help becaue it's not clear if your true/false values are Boolean true/false or if you are using text strings.

If you are using Boolean True/False then your data would look like this

boolean-table.png

and you would use this query to create a Custom Column

 

if [AccountTypeGroup] = "Client" or [Is Target] = true 

then true 

else if [AnnualRevenue] >= 250000000 and [Has Products] = true and [Marketing Country] = true

then true 

else false

 

 

If you are using text columns for True/False you're data will look something like this (notice the icons in the column headers are different for True/False compared to the Boolean columns above)

table-text.png

Using text adds another complication in that the text string True is not the same as the text string true, but you could use a query like this

 

if [AccountTypeGroup] = "Client" or [Is Target] = "True" 

then true 

else if [AnnualRevenue] >= 250000000 and [Has Products] = "True" and [Marketing Country] = "True" 

then true 

else false

 

 

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Ashish_Mathur
Super User
Super User

Hi,

Remove the "" from around the true.  Also, Mashup ("M") - the language of the Query Editor is case sensitive.  So ensure that case of true matches with the case of true in the 3 columns.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.