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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

If - Then - without Else

Hi everyone, 

 

I have a marketing database with thousands of email addresses and company names and I import all these data in Power Bi.

 

Unfortunately our system doesn't talk with our CRM and this is a problem cause when people go on our Power Bi dashboard they filter a company name using the one on our CRM system but it might happen that the company's name on Power Bi is different. An example would be like below:

 

Marketing

Company name = Water for Sport

 

CRM:

Company name = Water Sport

 

Now a way that I have found to fix this issue is using the conditional statement 'IF - Then' in Power Bi. For instance I can say: If email address contains @watersport.com then company name is 'Water for Sport'. 

 

The above logic works perfectly however in this type of statement there is then the option 'else'. This results to be a problem for my specific case cause as i said before I have thousands of companies and actually the ones I am interested to 'trim' are just around 200. If I proceed with this approach I will then loose all the other companies for which I don't set up a rule. 

 

I was wondering then if there is a way to use the 'If and then' statement ignoring the 'Else' command. Just to let you know if I leave the 'else' blank then all the other companies won't appear.

 

Thanks in advance, 

Alessandro

2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

Hi @Alessandro-laba 

If you are doing this in Power Query and creating a Custom Column, then you are checking an existing column to check the email address.  If you don't find the text you are searching for, the else can just output this unmodified column - for example

 

if Text.Contains([Email_Address] , "@watersport.com") then "Water for Sport" else [Email_Address]

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

AlB
Super User
Super User

Hi@Alessandro-laba 

I'm not sure I understand fully. You can perhaps  do something like:

= if Text.Contains([emailaddress], "@watersport") then  "Water for Sport"  else [emailaddress]

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

3 REPLIES 3
AlB
Super User
Super User

Hi@Alessandro-laba 

I'm not sure I understand fully. You can perhaps  do something like:

= if Text.Contains([emailaddress], "@watersport") then  "Water for Sport"  else [emailaddress]

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

PhilipTreacy
Super User
Super User

Hi @Alessandro-laba 

If you are doing this in Power Query and creating a Custom Column, then you are checking an existing column to check the email address.  If you don't find the text you are searching for, the else can just output this unmodified column - for example

 

if Text.Contains([Email_Address] , "@watersport.com") then "Water for Sport" else [Email_Address]

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you very much, it worked perfectly!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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