Forum Discussion
Two improvements around email
- 3 years ago
Hi Kreg
You can achieve your goals by following these easy steps at PQ:
1. Split your name column by first space:2. Trim your columns
3. On your second column replace space by . ( space is just pressing space on keyboard)
4. Lowercase your profile column
* M language is case sensible5. Add custom Column with code:
if [Profile] = "pr" then [Name.1]&[Profile]&"."&[Name.2]&"." & " @comapny.com"
else
[Name.1]&"."&[Name.2]&"."& " @comapny.com"Result :
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thanks Ritaf, just last question. Can we do the fifth point with Dax query? I mean not from that level which you showed, but from the Report view.
- Ritaf19833 years agoSuper User
Hi Kreg
It can also be done with DAX.
Add the calculated column using the following Code:Formated mail =VAR Name_with_spaces =IF ([Profile] = "pr",LEFT ( [Name], SEARCH ( " ", [Name] ) - 1 )& LOWER ( 'Table (2)'[Profile] ),LEFT ( [Name], SEARCH ( " ", [Name] ) - 1 ))& RIGHT ('Table (2)'[Name],LEN ( 'Table (2)'[Name] )- LEN ( LEFT ( [Name], SEARCH ( " ", [Name] ) - 1 ) ))RETURNSUBSTITUTE ( Name_with_spaces, " ", "." ) & "@company.com"Link to the updated sample file
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly