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
Disaster110
Helper I
Helper I

Formatting blanks lines in outlook email with DAX

Hi All,
I have a great little measure in a Power BI report that drafts a booking email based on the users choices. The measure works fine, but I am having diffculty getting it to format the email correctly. Most notably, formatting blank lines into the email between text. I have tried several DAX commands with no luck. 
This is the current DAX code (Wherever there is UNICHAR(10) should be a blank line between text) - 

Email Link =
"mailto:emailaddress" &
"?subject=" & "Training booking request" & " " & 'Available Courses'[Course Name] & " " &'Available Courses'[Commenced] &
"&body=" & "I (Enter name) would like apply to attend: " & " " & 'Available Courses'[Course Name] & " " &"Training " & " " & "on" & " " & 'Available Courses'[Commenced] & " " & "at " & " " &  'Available Courses'[Start Time]
& UNICHAR(10) & UNICHAR(10) &
    "Need some help?"
    & UNICHAR(10) &
    "Learning and Development will confirm your preferred date via an iCal Microsoft notification. If we are unable to offer you your selected date, one of the Learning and Development team members will contact you to discuss."
    & UNICHAR(10) & UNICHAR(10) &
    "Be sure to check your training bookings via the HR044 Training Compliance Report to ensure you remain compliant."
    & UNICHAR(10) & UNICHAR(10) &
    "Need some help? Please contact L&D Support on 00 000 000 00."
    & UNICHAR(10) &
    "L&D Support"
This is how the eamil comes out - 

I (Enter name) would like apply to attend:  Cardio-Pulmonary Resuscitation -CPR Training  on 2024-02-07 at  0730Need some help?Learning and Development will confirm your preferred date via an iCal Microsoft notification. If we are unable to offer you your selected date, one of the Learning and Development team members will contact you to discuss.Be sure to check your training bookings via the HR044 Training Compliance Report to ensure you remain compliant.Need some help? Please contact L.........
Does anyone know how to format this email in DAX to include the line breaks?
Thankyou in advance

1 ACCEPTED SOLUTION
Disaster110
Helper I
Helper I

Thanks for your help Team,
I have solved this with help from a collegue. To keep the formatting with line breaks from PBI to Outlook email, I had to add %0a to the front of the text were the new line should start. See below - 

Email Link = "mailto:emailaddress" & "?subject=" & "Training booking request" & " " & 'Available Courses'[Course Name] & " " & 'Available Courses'[Commenced] & "&body=" & "I (Enter name) would like apply to attend: " & " " & 'Available Courses'[Course Name] & " " & "Training " & " " & "on" & " " & 'Available Courses'[Commenced] & " " & "at " & " " & 'Available Courses'[Start Time]& UNICHAR(13) & UNICHAR(10) & "%0a" & UNICHAR(13) & UNICHAR(10) & "%0aNeed some help?" & UNICHAR(13) & UNICHAR(10) & "%0aLearning and Development will confirm your preferred date via an iCal Microsoft notification. If we are unable to offer you your selected date, one of the Learning and Development team members will contact you to discuss." & UNICHAR(13) & UNICHAR(10) & UNICHAR(13) & UNICHAR(10) & "%0aBe sure to check your training bookings via the HR044 Training Compliance Report to ensure you remain compliant." & UNICHAR(13) & UNICHAR(10) & UNICHAR(13) & UNICHAR(10) & "%0aContact L&D Support on 00 000 000 00 for further assistance" & UNICHAR(13) & UNICHAR(10) & "%0aL&D Support"
 
Regrads, Disatser



View solution in original post

6 REPLIES 6
Disaster110
Helper I
Helper I

Thanks for your help Team,
I have solved this with help from a collegue. To keep the formatting with line breaks from PBI to Outlook email, I had to add %0a to the front of the text were the new line should start. See below - 

Email Link = "mailto:emailaddress" & "?subject=" & "Training booking request" & " " & 'Available Courses'[Course Name] & " " & 'Available Courses'[Commenced] & "&body=" & "I (Enter name) would like apply to attend: " & " " & 'Available Courses'[Course Name] & " " & "Training " & " " & "on" & " " & 'Available Courses'[Commenced] & " " & "at " & " " & 'Available Courses'[Start Time]& UNICHAR(13) & UNICHAR(10) & "%0a" & UNICHAR(13) & UNICHAR(10) & "%0aNeed some help?" & UNICHAR(13) & UNICHAR(10) & "%0aLearning and Development will confirm your preferred date via an iCal Microsoft notification. If we are unable to offer you your selected date, one of the Learning and Development team members will contact you to discuss." & UNICHAR(13) & UNICHAR(10) & UNICHAR(13) & UNICHAR(10) & "%0aBe sure to check your training bookings via the HR044 Training Compliance Report to ensure you remain compliant." & UNICHAR(13) & UNICHAR(10) & UNICHAR(13) & UNICHAR(10) & "%0aContact L&D Support on 00 000 000 00 for further assistance" & UNICHAR(13) & UNICHAR(10) & "%0aL&D Support"
 
Regrads, Disatser



That means you don't need any of the UNICHAR pieces.

v-xiandat-msft
Community Support
Community Support

Hi @Disaster110 ,

UNICHAR(13) corresponds to the carriage return character (also known as newline or line feed). It is used to move the cursor to the beginning of the next line in a text document.

Below is the revised DAX:

Email Link =
"mailto:emailaddress" & 
"?subject=" & "Training booking request" & " " & 'Available Courses'[Course Name] & " " & 'Available Courses'[Commenced] &
"&body=" & 
"I (Enter name) would like apply to attend: " & " " & 'Available Courses'[Course Name] & " " &
"Training " & " " & "on" & " " & 'Available Courses'[Commenced] & " " & "at " & " " & 'Available Courses'[Start Time]& 
UNICHAR(13) & UNICHAR(10) & 
UNICHAR(13) & UNICHAR(10) & 
"Need some help?" & 
UNICHAR(13) & UNICHAR(10) & 
"Learning and Development will confirm your preferred date via an iCal Microsoft notification. If we are unable to offer you your selected date, one of the Learning and Development team members will contact you to discuss." &
UNICHAR(13) & UNICHAR(10) &
UNICHAR(13) & UNICHAR(10) & 
"Be sure to check your training bookings via the HR044 Training Compliance Report to ensure you remain compliant." &
UNICHAR(13) & UNICHAR(10) &
UNICHAR(13) & UNICHAR(10) & 
"Need some help? Please contact L&D Support on 00 000 000 00." &
UNICHAR(13) & UNICHAR(10) &
"L&D Support"

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thankyou @v-xiandat-msft 
This works well in PBI and returns the desired result - 

Disaster110_0-1707098917675.png

However, once it cuts a draft email in Outlook, it reverts back to this - 

I (Enter name) would like apply to attend:  Cardio-Pulmonary Resuscitation -CPR Training  on 2024-02-07 at  0730Need some help?Learning and Development will confirm your preferred date via an iCal Microsoft notification. If we are unable to offer you your selected date, one of the Learning and Development team members will contact you to discuss.Be sure to check your training bookings via the HR044 Training Compliance Report to ensure you remain compliant.Need some help? Please contact L

So I am thinking this must be an outlook issue. 
Appreciate your help.

lbendlin
Super User
Super User

try "<BR>"  instead.

Thanks @lbendlin, I tried that one - 
Still comes back like this in the email - 

I (Enter name) would like apply to attend:  Cardio-Pulmonary Resuscitation -CPR Training  on 2024-02-07 at  0730<BR>This text on next line

Maybee it is an Outlook thing unrelated to PBI??

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.