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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
aso1
Helper II
Helper II

if statement column

I have a column with different usernames. some contain some prefixes such as "DOMAIN\" and others dont have these prefixes. 

I want a custom column that attaches a text if X is something.  Exactly like this : 

 

Desired output :

if Name starts with 'NT SERVICE' or 'NT Authority' then type 'SQL System'

if Name starts with 'DOMAIN\' then type 'Windows Authentification'

if Name starts does NOT start with "DOMAIN" - then type SQL Authentification'

 

 

powerbi_customcolumnfor SQL_WindowsUsers.jpg

 

how can I achieve this? I would like to create a custom-column preferably. 

 

thanks!

 

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @aso1 ,

 

Try this for a custom column on Power Query:

 

if Text.StartsWith(Text.Upper([Column1]), "NT SERVICE")
or Text.StartsWith(Text.Upper([Column1]), "NT AUTHORITY")
then "SQL System"
else
if Text.StartsWith(Text.Upper([Column1]), "DOMAIN\") then
"Windows Authentication"
else "SQL Authentication"



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

2 REPLIES 2
camargos88
Community Champion
Community Champion

Hi @aso1 ,

 

Try this for a custom column on Power Query:

 

if Text.StartsWith(Text.Upper([Column1]), "NT SERVICE")
or Text.StartsWith(Text.Upper([Column1]), "NT AUTHORITY")
then "SQL System"
else
if Text.StartsWith(Text.Upper([Column1]), "DOMAIN\") then
"Windows Authentication"
else "SQL Authentication"



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Pragati11
Super User
Super User

HI @aso1 ,

 

You can create a calculated column using DAX as follows:

 

ifContainsString = IF(CONTAINSSTRING(youTable[Name], "NT SERVICE") = TRUE() || CONTAINSSTRING(youTable[Name], "NT Authority") = TRUE(), "SQL System", 
IF(CONTAINSSTRING(youTable[Name], "DOMAIN\") = TRUE() , "Windows Authentification", "SQL Authentification"))
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.