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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Calculated Column

Hey all,

I've got a column containing e-mail adresses. I need to categorize this into three groups:
An e-mail containing the string "unknown" should be categorized as "unknown"
An empty cell should be categorized as "unknown"
An e-mail containing "jnj" should be categorized as "business"
Otherwise an e-mail should be categorized as "private"

I've written the following custom column:

Type E-mail =
SWITCH(TRUE(),
CONTAINSSTRING('Data'[e-mail],"onbekend"),"unknown",
ISBLANK('Data'[e-mail]),"unknown",
CONTAINSSTRING('Data'[e-mail],"jnj"),"business","private")

However empty cells are returned as "private". 

What did I do wrong?
1 ACCEPTED SOLUTION

@Anonymous 

Try

Type E-mail =
SWITCH (
    TRUE (),
    CONTAINSSTRING ( 'Data'[e-mail], "*onbekend*" ), "unknown",
    'Data'[e-mail] = BLANK (), "unknown",
    CONTAINSSTRING ( 'Data'[e-mail], "*jnj*" ), "business",
    "private"
)

View solution in original post

7 REPLIES 7
Jasonk-WP43
New Member

I have an Excel sheet with customer order details, I would like to calculate the following:

  • Number of registered customers since starting the online store (Just the number of customers to date)
  • Top cities or areas within the city that ordered
  • Total Unit Sales and Total Revenue

     

How can I achieve this 

 

Thanks in advance 

tamerj1
Community Champion
Community Champion

Hi @Anonymous 

You need to use wild cards

Type E-mail =
SWITCH (
    TRUE (),
    CONTAINSSTRING ( 'Data'[e-mail], "*onbekend*" ), "unknown",
    ISBLANK ( 'Data'[e-mail] ), "*unknown*",
    CONTAINSSTRING ( 'Data'[e-mail], "*jnj*" ), "business",
    "private"
)
Anonymous
Not applicable

Actually the categories work fine for all cells, except the empty cells.
The empty cells return "private". So somehow the Isblank part of the formula doesn't work properly.

@Anonymous 

Try

Type E-mail =
SWITCH (
    TRUE (),
    CONTAINSSTRING ( 'Data'[e-mail], "*onbekend*" ), "unknown",
    'Data'[e-mail] = BLANK (), "unknown",
    CONTAINSSTRING ( 'Data'[e-mail], "*jnj*" ), "business",
    "private"
)
johnt75
Super User
Super User

Check that the cells are truly empty as opposed to having an empty string or a space character or something

Anonymous
Not applicable

Hey Johnt75. I did check them for spaces or something. The cells are truly empty.

There doesn't appear to be anything wrong with the SWITCH statement. You could add a new column

Is Blank = ISBLANK ( 'Data'[e-mail] )

and see if that gives the expected results

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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