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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Community Champion
Community Champion

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!:
DAX For Humans

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors