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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

Follow on LinkedIn
@ 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.