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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mjanecek
Helper I
Helper I

Carriage Return in Dax Measure Returning Concantenated Text

Hi: I'm writing a measure that will concantenate text and scalar values to form a narrative I will place in a shape's Text.

 

I want to put carriage returns to create new lines at specific points in the narrative.  Its my understanding that 10 is the chracter number that allows a line break to be inserted into a dax measure returning text when used with the UNICHAR function.

 

Below is my code, and as you can see when the measure is put into the screen shot of the visual, the text is still on one line.

 

Narrative =
 
var label =   "Retailer Parent: " & max('top Retail Parents'[Retail Parent]) & " " & UNICHAR(10)
var label2 = "My return should go above this text"
return CONCATENATE(label,label2)
 
mjanecek_0-1714569628715.png

 

 

Any Help is Appreciated.

 

Mark Janecek 

BI Analyst

Amwins Insurance

4 REPLIES 4
v-kaiyue-msft
Community Support
Community Support

Hi @mjanecek ,

 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

Best Regards,

Clara Gong

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

Kaviraj11
Responsive Resident
Responsive Resident

Hi, Try this  and make sure to have the Text Wrap option activated & you can adjust accordingly to your requirement. 

 

Narrative  =
var label =   "Retailer Parent: " & "ABC" & " " & UNICHAR(10)
var label2 = "My return should go above this text"
return  label & UNICHAR(10) & label2
 
Or 
 
Narrative  =
var label =   "Retailer Parent: " & "ABC" & " " & UNICHAR(10)
var label2 = "My return should go above this text"
return  CONCATENATE(CONCATENATE(label,UNICHAR(10)), label2)
 
Kaviraj11_0-1714572310237.png

 

This works when I put the measure into a card, but not a shape.  

 

Narrative =
var label =   "Retailer Parent: " & max('top Retail Parents'[Retail Parent]) & " " &  UNICHAR(10)
 var label2 =
" Grossed a Total of "
&  "$" & FORMAT(ROUND([Revenue or Premium Field],0),"#,###,###,###,###") & " from " & Min('Transaction Detail'[Accounting Month]) & " to " & max('Transaction Detail'[Accounting Month]) &  ".  This covers " & DISTINCTCOUNT('Transaction Detail'[Amwins Division]) & " Divisions ," & DISTINCTCOUNT('top LOBs'[LOB]) & " Lines of Business ," & DISTINCTCOUNT('top Market Parents'[Market Parent]) & " Market Parents, and" & DISTINCTCOUNT('top Retail Parents'[Retail Parent]) & "  Retail Parents"
 RETURN label & UNICHAR(10) & label2
 
I want to align the text left.  The shape allows me that option, but the card does not.  Also, if I turn off text wrap on the card, It does not work.
 
mjanecek_0-1714572895700.png

 

Mark Janecek

BI Analyst 

Amwins Insurance

@mjanecek Unfortunately the support for carriage returns in visuals is not universal. You might have better luck with the new Preview card visual, but it's preview.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.