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
Paulyeo11
Impactful Individual
Impactful Individual

How to flag Company name with funny character and only single word ?

Hi All

I have below raw data :-

Company

@abc

#123

SMC

ADL

TDS Technology Pte Ltd

 

My Expected result :-

Company,Flag

@abc,Funny Charater

#123,Funny Charater

SMC,Signle word Company name

ADL,Signle word Company name

TDS Technology Pte Ltd,Not Issue

 

Hope some one can advise me.

 

Paul Yeo

 

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

Thanks, @HotChilli  for your clarification and kind words  🙂

 

@Paulyeo11 

You need to have two tables, one for the Signs @,# etc and the other for the single word company names :

Fowmy_0-1601810201394.png

Fowmy_1-1601810220110.png


Then, you will and thy following column to your table to have the desired results.

Flag = 
VAR _SignFlag = LEFT([Company],1) IN VALUES(SignsList[Sign]) 
VAR _Space = CONTAINSSTRING(TRIM([Company])," ")

VAR _SingleWord =   NOT(_Space) && NOT(_SignFlag)
VAR _Sign = NOT(_Space) && _SignFlag
VAR _FullName = _Space && NOT(_SignFlag)

RETURN

SWITCH( TRUE(),
    _Sign , LOOKUPVALUE(SignsList[Character],SignsList[Sign],LEFT([Company],1)),
    _SingleWord , LOOKUPVALUE(CompanyList[Full Name],CompanyList[Word],[Company]),
    _FullName, [Company]
)

 

Fowmy_2-1601810259899.png

 

You can download the file: HERE

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

 

 

 

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

4 REPLIES 4
Fowmy
Super User
Super User

Thanks, @HotChilli  for your clarification and kind words  🙂

 

@Paulyeo11 

You need to have two tables, one for the Signs @,# etc and the other for the single word company names :

Fowmy_0-1601810201394.png

Fowmy_1-1601810220110.png


Then, you will and thy following column to your table to have the desired results.

Flag = 
VAR _SignFlag = LEFT([Company],1) IN VALUES(SignsList[Sign]) 
VAR _Space = CONTAINSSTRING(TRIM([Company])," ")

VAR _SingleWord =   NOT(_Space) && NOT(_SignFlag)
VAR _Sign = NOT(_Space) && _SignFlag
VAR _FullName = _Space && NOT(_SignFlag)

RETURN

SWITCH( TRUE(),
    _Sign , LOOKUPVALUE(SignsList[Character],SignsList[Sign],LEFT([Company],1)),
    _SingleWord , LOOKUPVALUE(CompanyList[Full Name],CompanyList[Word],[Company]),
    _FullName, [Company]
)

 

Fowmy_2-1601810259899.png

 

You can download the file: HERE

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

 

 

 

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

Paulyeo11
Impactful Individual
Impactful Individual

Wow you are the expert . Thank 

Fowmy
Super User
Super User

@Paulyeo11 

If you have a handful of companies, you can try the Window emojis by adding a column ( WIN + .  ) like

Fowmy_0-1601805422767.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

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

@Fowmy    you are a great contributor to the forum.  I loved your answer on this one, however I think the OP is trying to flag up if a "funny character" is contained already in the string.

 

@Paulyeo11  you are going to have to define a list of funny characters (or make a rule that anything that is not a letter or number is a "funny character").  I've had a quick play in Power Query by adding a column like this

 

if not List.ContainsAny(Text.ToList([Column1]), {"a".."b"}) then 1 else 0)

so it could be something similar 

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.