cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DiegoReis Member
Member

New column in Power Query with SQL statement

Hi all.

 

Need to Create a new column in power query with this SQL Statement

 

(TEXTO not like '%ORD 9%' and TEXTO not like '%ORD 6%' and TEXTO not like '%Reclassificação%' and TEXTO not like '%TRANSITORIA%' and(TEXTO <> '' or TEXTO_CAB like '%tarifa%'))

 

 

I tried this, but it did not work

 

   if
      List.AllTrue({
      not Text.Contains([TEXTO], "ORD 9"),
      not Text.Contains([TEXTO], "ORD 6"),
      not Text.Contains([TEXTO], "Reclassificação"),
      not Text.Contains([TEXTO], " "),
      not Text.Contains([TEXTO], "TRANSITORIA"),
         List.AnyTrue({
            [TEXTO] <> "",
            Text.Contains([TEXTO_CAB], "tarifa")
         }),
      })
then "True"
else "False"

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft Eric_Zhang
Microsoft

Re: New column in Power Query with SQL statement


@DiegoReis wrote:

Can you show me how to create this column?


@DiegoReis

You can just add a custom column via the UI if you don't know how to edit in the advanced editor. @Greg_Deckler's solution actually works in my test, when you say it doesn't work, could you be more specific?

customcolumn.gif

View solution in original post

6 REPLIES 6
Super User IV
Super User IV

Re: New column in Power Query with SQL statement

Try this:

 

    #"Added Conditional Column1" = Table.AddColumn(#"Unpivoted Columns", "Custom1", each if
      List.AllTrue({
      not Text.Contains([TEXTO], "ORD 9"),
      not Text.Contains([TEXTO], "ORD 6"),
      not Text.Contains([TEXTO], "Reclassificação"),
      not Text.Contains([TEXTO], " "),
      not Text.Contains([TEXTO], "TRANSITORIA"),
         List.AnyTrue({
            [TEXTO] <> "",
            Text.Contains([TEXTO_CAB], "tarifa")
         })
      })
then "True"
else "False")

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

DiegoReis Member
Member

Re: New column in Power Query with SQL statement

I did not understand how to do this column, is not it an ordinary column?

DiegoReis Member
Member

Re: New column in Power Query with SQL statement

Can you show me how to create this column?

DiegoReis Member
Member

Re: New column in Power Query with SQL statement

Don't worked

Microsoft Eric_Zhang
Microsoft

Re: New column in Power Query with SQL statement


@DiegoReis wrote:

Can you show me how to create this column?


@DiegoReis

You can just add a custom column via the UI if you don't know how to edit in the advanced editor. @Greg_Deckler's solution actually works in my test, when you say it doesn't work, could you be more specific?

customcolumn.gif

View solution in original post

DiegoReis Member
Member

Re: New column in Power Query with SQL statement

Thank you, But don't worked =/

 

 

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors