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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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


@Anonymous wrote:

Can you show me how to create this column?


@Anonymous

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
Greg_Deckler
Super User
Super User

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")

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Don't worked

Anonymous
Not applicable

Can you show me how to create this column?


@Anonymous wrote:

Can you show me how to create this column?


@Anonymous

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

Anonymous
Not applicable

Thank you, But don't worked =/

 

 

Anonymous
Not applicable

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.