Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerQuery - Check if Column value equals true

Tags:

powerquery

I have build several additional columns in PowerQuery based on my source data. This includes two "TextContains" columns which only return "TRUE" or "FALSE". I now want an additional Column highlighting the different service types and used this:

if [PSTag] = "PS" then "PS" 
else if [Trainingskit] = "TrainingsKit" then "Training"
else if [Training] = "Training" then "Training"
else if [HardwareService] = "TRUE" then "HardwareService"
else if [TelephoneService] = "TRUE" then "TelephoneService" else "NonService"

It works fine for the first three IF statements, but doesn't work at all for the Columns containing only "TRUE" or "FALSE". The first three contain either e.g. "PS" or "NonPS" or "Training" or "NonTraining"

I'm sure I'm "just" missing a very fundamental here.

Any help is highly appreciated.

like image 989
f0rd42 Avatar asked Oct 27 '25 18:10

f0rd42


1 Answers

Columns containing only TRUE or FALSE are likely the "True/False" datatype. Their values appear in italic font in the Query Preview window.

If that is the case with your [HardwareService] and [TelephoneService] columns then I would remove the quotes e.g. write something like:

... if [HardwareService] = true then ...
like image 80
Mike Honey Avatar answered Oct 30 '25 10:10

Mike Honey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!