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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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.

Anonymous
Not applicable

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 @Anonymous 
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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors