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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
ppgandhi11
Helper V
Helper V

how to get text in new line in the data cards/label?

Hi,

 

How do i create a label that is multi lines? each line should contain a specific filter info. I am able to get all the filter info I need using DAX formulas but they all appear in the same line!

 

I tried to review this page:

 

https://community.powerbi.com/t5/Desktop/How-to-get-text-in-new-line-using-data-cards/m-p/227630/hig...

 

But I was un successful in getting this.

 

Here is my code for measure called Title:

 

Title =
var selectedicds = values(BaseQuery[icd1])
var numberofselectedicds = countrows(selectedicds)
var numberofpossibleicds = CALCULATE(DISTINCTCOUNT(BaseQuery[icd1]), all(BaseQuery[icd1]))
return
"Detailed report for: " & UNICHAR(10) & "icd:" & if (numberofselectedicds = numberofpossibleicds, "All", CONCATENATEX (VALUES(BaseQuery[icd1]), BaseQuery[icd1], ","))

 

In above code, I am expecting the label to look like:

 

Detailed report for:

icd: H10.01,H10.02

 

Current output:

 

Details report for: icd: H10.01,H10.02

 

1 ACCEPTED SOLUTION

I see, hmm....interesting. I wonder if it's some obscure system setting somewhere.

Normally I share files on this forum by posting a Dropbox or OneDrive link - would you be able to share your PBIX that way?

 

In the mean time, another method you could try is explicitly entering a newline character by pressing Alt-Enter in the formula bar.

For example:

Two Line Measure = 
VAR NewLine =
"
"
RETURN
"Hello" & NewLine & "World"

I pressed Alt-Enter between the two double-quotes in the NewLine definition.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

10 REPLIES 10
AbelNewton
Frequent Visitor

Third-party visual plug-ins is what you need. You could try Text Wrapper by MAQ Software. 

2 years later but this was helpful, thanks for this suggestion.

OwenAuger
Super User
Super User

Hi @ppgandhi11

 

I was able to get a simple measure like yours with contatenation including UNICHAR(10) displaying on multiple lines.

 

The text displayed on multiple lines in the Card visual (but not Multi-row card), Table, Matrix, or Text Wrapper custom visual.

 

What visual were you trying to include the text in, and can you post a PBIX file exhibiting the problem?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

AnkitaBIUSer_0-1727953167764.png

UNICHAR(10) doesnt work 

@AnkitaBIUSer 

Yes, newline characters (however constructed) are unfortunately ignored within data labels.

 

The original post concerned displaying text across multiple lines in a card visual. At that time enhanced data labels had not been released (so an arbitrary measure could not be used to specify a data label).

 

You could get three lines of text by making use of separate measures for Value, Title, and Detail labels (with Multi-line enabled) as described here, depending on the visual,


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hi @OwenAuger

 

I tried using both single row card visual and multi-row card visual. Both of them give the exact same output I had mentioned. For some reason, this user group does not allow me to send the PBIX file. So I am sending you the screen shots instead. (I had asked that question before in the group, and someone replied saying attaching files are allowed only if I have certain account type e.g. contributor etc).

 in the first screenshot, the left side is the single row card visual, right side is multi row card visual.

in the second screenshot, the forumula used is shown.

 

expected output for single row card visual is (due to unichar(10) 😞

Detailed report for:

icd: ....

Capture.PNGCapture1.PNG

 

 

I see, hmm....interesting. I wonder if it's some obscure system setting somewhere.

Normally I share files on this forum by posting a Dropbox or OneDrive link - would you be able to share your PBIX that way?

 

In the mean time, another method you could try is explicitly entering a newline character by pressing Alt-Enter in the formula bar.

For example:

Two Line Measure = 
VAR NewLine =
"
"
RETURN
"Hello" & NewLine & "World"

I pressed Alt-Enter between the two double-quotes in the NewLine definition.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Adding a variable with alt+enter alos dont work

AnkitaBIUSer_1-1727953231803.png

 



How to achieve this in power query

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Hi @OwenAuger

 

This works. Due to security reasons, my work laptop (which has power BI installed) has onedrive and dropbox de-activated so posting PBIX there is not possible.

 

This solution works! Thanks a lot. (by creating a variable called NewLine as suggested by you).

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.