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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.