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
AKARSEVGI
Helper I
Helper I

POWER QUERY IF

How can I rewrite this -------
IF(( ("PROJE NO" LIKE '%.S.%' OR "PROJE NO" LIKE '%.s.%' OR "PROJE NO" NOT LIKE '%.%' OR "PROJE NO" IS NULL ) AND "SERVİS TANIM" IS NULL AND "SERVİS TİPİ" IS NULL) THEN [COUNTRY]&"é"&900, ELSE IF[COUNTRY]&"é"&[SALDEPT])--------- in power query with custom column formulas?

3 REPLIES 3
YalanWu_test
Helper I
Helper I

Hi, @AKARSEVGI ;

If a dax.

column =
IF (
    (
        (
            CONTAINSSTRING ( [PROJE NO], ".S." ) || CONTAINSSTRING ( [PROJE NO], ".s." )
                || CONTAINSSTRING ( [PROJE NO], "." )
                || [PROJE NO] = BLANK ()
        )
            && [SERVİS TANIM] = BLANK ()
            && [SERVİS TİPİ] = BLANK ()
    ),
    [COUNTRY] & "é" & "900",
    [COUNTRY] & "é" & [SALDEPT]
)

If in power query.

=if  (Text.Contains([PROJE NO],".s.") || Text.Contains([PROJE NO],".S.")  || Text.Contains([PROJE NO],".")  
|| [PROJE NO] = null )
&& [SERVİS TANIM] = null
&& [SERVİS TİPİ] = null 
 then  [COUNTRY] & "é" & "900" 
 else [COUNTRY] & "é" & [SALDEPT]

YalanWu_test_0-1660033400095.png

Best Regards,

marcelsmaglhaes
Super User
Super User

Hey @AKARSEVGI !

 

You can use the 'not Text.Contains' to check the values.  Create a new column to recieve checked value.

The basis is: 
Table.AddColumn(#"Added Conditional Column", "Custom", each if not Text.Contains([Status], "S.") then "Country" else if not Text.Contains([Status], "s.") then "Country" else "Another information")

 

** If this post helps, please consider accept as solution to help other members find it more quickly.

Regards
Marcel Magalhaes


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



lbendlin
Super User
Super User

Power Query uses small letters

 

IF => if

IS NULL => = null

AND => and

 

etc.

 

Power Query does not have a concept of "LIKE" - you need to write that manually.

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.

Users online (3,715)