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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Create new column (flag) to distinguish pages containing certain keyword

Hi, I am new to Power BI and have below question looking for help!

 

I am trying to create a new column that will help me distinguish pages with or without keyword: "base-center/secure". I have written this formula but it is getting error: 

=if(CONTAINSSTRING(Pageviews[page_pagePath],"base-center/secure")) then"center visit" else "null"
 
Any suggestion/idea is appreicated!
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

If you want a calculated column with DAX, it should be 

flag =
IF (
    CONTAINSSTRING ( Pageviews[page_pagePath], "base-center/secure" ),
    "center visit",
    "null"
)

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

If you want a calculated column with DAX, it should be 

flag =
IF (
    CONTAINSSTRING ( Pageviews[page_pagePath], "base-center/secure" ),
    "center visit",
    "null"
)

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

AlexisOlson
Super User
Super User

CONTAINSSTRING is a DAX function, not an M function (Power Query language).

 

In M, you'd write it like this:

if Text.Contains([page_pagePath], "base-center/secure") then "center visit" else "null"

assuming that [page_pagePath] is a column in the same table you're working with. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Kudoed Authors