Forum Discussion
Power Query Create Column Syntax
- 5 years ago
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
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 falseIf 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)
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 falseRegards
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.
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
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)
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.