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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors