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
csb
Frequent Visitor

Find a String Pattern in a Column using DAX

I have a requirement to find whether a string given in Logon column contains a 'wauser'  pattern ornot . If it contains the pattern it should return 1,if not 0.

I have data shown below

QtyLogonTran_DateItem_Nbr
-100memwauser:MEM.MAIN9/17/202444675F|20
-100memwauser:MEM.MAIN10/15/202444152F|20
1,313cmurray:CBC.MAIN9/17/202443807|01
1,313joldenburg:CBC.MAIN9/17/202443807|01

 

Final Result should look like 

QtyLogonTran_DateItem_NbrUsertype
-100memwauser:MEM.MAIN9/17/202444675F|201
-100memwauser:MEM.MAIN10/15/202444152F|201
1,313cmurray:CBC.MAIN9/17/202443807|010
1,313joldenburg:CBC.MAIN9/17/202443807|010

 

Can you please let me know how this can be achieved using DAX in Power BI Desktop ?

 

Thanks..

2 ACCEPTED SOLUTIONS
wini_R
Solution Supplier
Solution Supplier

Hi @csb,

You may want to add the following measure to get what you need:

UserType = 
IF(CONTAINSSTRING(SELECTEDVALUE('Table'[Logon]), "memwauser"), 1, 0)

wini_R_0-1738963548303.png

 

View solution in original post

Fowmy
Super User
Super User

@csb 

You can add calculated column as follows:

Fowmy_0-1738964311813.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Your solution is so great Fowmy and wini_R 

Hi, @csb 

I wish you all the best. Previously Super user and wini_R have provided a solution to help you solve the problem. Since we haven't heard back from you yet, I'd like to confirm if you've successfully resolved this issue or if you need further help?
If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.
If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.

 

 

Best Regards

Jianpeng Li

Fowmy
Super User
Super User

@csb 

You can add calculated column as follows:

Fowmy_0-1738964311813.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

wini_R
Solution Supplier
Solution Supplier

Hi @csb,

You may want to add the following measure to get what you need:

UserType = 
IF(CONTAINSSTRING(SELECTEDVALUE('Table'[Logon]), "memwauser"), 1, 0)

wini_R_0-1738963548303.png

 

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.