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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Walt1010
Frequent Visitor

Comparison between String and Column Value not working

Hi, I am trying to do a very simple comparison between all the values in a column (Job Titlle) in another table (FMS Carers) and the string literal "Agency worker", but it seems to fail the test each time, although some of the filds do contain "Agency worker".

Here is the code:

#"Agency" = Table.AddColumn(#"Replaced Value","Agency", each if #"FMS Carers"[Job Title] = "Agency worker" then "Agency" else "PT Staff")

 

This always returns "PT Staff" although the column contains instances of "Agency worker". I tried TextContains but hit an error message about comparing a list and text, so I've reverted to "=". Any ideas?

2 ACCEPTED SOLUTIONS
HotChilli
Super User
Super User

Easiest way will probably be to Merge the 2 tables on Date to return the fields you need

View solution in original post

v-junyant-msft
Community Support
Community Support

Hi @Walt1010 ,

@HotChilli Thank you for your concern about this case! I agree with you.
Have you solved your problem? If not, what @HotChilli said is as below, you can follow these steps:
Here is my sample data:

vjunyantmsft_0-1711345164132.png

vjunyantmsft_1-1711345171666.png

First, merge queries:

vjunyantmsft_2-1711345214965.png

vjunyantmsft_3-1711345244489.png

The output is as below:

vjunyantmsft_4-1711345265324.png

Expand the table:

vjunyantmsft_5-1711345279397.png

vjunyantmsft_6-1711345287772.png

Then add custom columns:

vjunyantmsft_7-1711345457777.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept both of the answers as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-junyant-msft
Community Support
Community Support

Hi @Walt1010 ,

@HotChilli Thank you for your concern about this case! I agree with you.
Have you solved your problem? If not, what @HotChilli said is as below, you can follow these steps:
Here is my sample data:

vjunyantmsft_0-1711345164132.png

vjunyantmsft_1-1711345171666.png

First, merge queries:

vjunyantmsft_2-1711345214965.png

vjunyantmsft_3-1711345244489.png

The output is as below:

vjunyantmsft_4-1711345265324.png

Expand the table:

vjunyantmsft_5-1711345279397.png

vjunyantmsft_6-1711345287772.png

Then add custom columns:

vjunyantmsft_7-1711345457777.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept both of the answers as the solution to help the other members find it more quickly.

HotChilli
Super User
Super User

Easiest way will probably be to Merge the 2 tables on Date to return the fields you need

Walt1010
Frequent Visitor

There are no defined links between the 2 tables. They each contain a Date field. I am trying to identify, for each date in the FMS Carers table, if there exists a matching date in the Holidays table. If such a match exists I'd like to put a flag to that effect in the FMS Cares table.

HotChilli
Super User
Super User

"a very simple comparison between all the values in a column (Job Titlle) in another table (FMS Carers) and the string literal "Agency worker"" - what's the link between 'this' table and the FMS Carers table?  There are no defined relationships in Power Query.

Can you be a bit clearer in what you are trying to do?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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
Top Kudoed Authors