Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

CONVERT SQL IN STATEMENT TO POWER QUERY

Hello everyone,

 

Because I am using OData as the data source, I cannot query data as I want when inputting to data model.

 

So I need to use Power Query to modify my table.

 

For example as the picture, there are table A and table B. I want to create a column in table A named ID_Name. If the value in column Name of table A exists in table B, the value in ID_Name column will be Name column only. Otherwise, it will be ID+Name.

 

Here is the example SQL statement:

SELECT CASE WHEN A.NAME IN (SELECT NAME FROM B)

             THEN A.ID

             ELSE A.ID+A.NAME END AS ID_NAME
FROM A

 

How can I convert this SQL statement into Power Query?

 

Thank you for your help.

 

1 Reply