Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression to align vertically and insert horizontal spaces

Hello,

Hopefully this is a simple task.

I have a test box which contains 6 expressions within which contains phrases. The expressions show a summary of KPIs and their corresponding values. See below.

=

'KPI 1' &'  =  '& Expression 1

&','

'KPI 2' &'  =  '& Expression 2

&','

'KPI 3' &'  =  '& Expression 3

&','

'KPI 4' &'  =  '& Expression 4

&','

'KPI 5' &'  =  '& Expression 5

&','

'KPI 6' &'  =  '& Expression 6

With the above set up and by re-sizing the text box, the KPIs and their corresponding values are tightly stacked on top of each other such as follows....

KPI 1 = 10

KPI 2 = 11

KPI 3 = 12 etc

I would like the above expression to be written such that the end result has horizontal spaces between each KPI and appears as seen below..........

KPI Name

KPI 1 = 10

KPI 2 = 11

KPI 3 = 12 etc

Any ideas please?

1 Solution

Accepted Solutions
sunny_talwar

Try if this helps:

='KPI 1' &'   =  '& Expression 1 & Chr(10) & Chr(10) &

  'KPI 2' &'  =  '& Expression 2 & Chr(10) & Chr(10) &

  'KPI 3' &'  =  '& Expression 3 & Chr(10) & Chr(10) &

  'KPI 4' &'  =  '& Expression 4 & Chr(10) & Chr(10) &

  'KPI 5' &'  =  '& Expression 5 & Chr(10) & Chr(10) &

  'KPI 6' &'  =  '& Expression 6 & Chr(10) & Chr(10)

View solution in original post

7 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Try adding chr(10)'s (carriage returns)

'KPI 1 = ' & Expression 1 & ',' & chr(10) & chr(10) &

'KPI 2 = ' & Expression 2 & ',' & chr(10) & chr(10)

etc..

sunny_talwar

Try if this helps:

='KPI 1' &'   =  '& Expression 1 & Chr(10) & Chr(10) &

  'KPI 2' &'  =  '& Expression 2 & Chr(10) & Chr(10) &

  'KPI 3' &'  =  '& Expression 3 & Chr(10) & Chr(10) &

  'KPI 4' &'  =  '& Expression 4 & Chr(10) & Chr(10) &

  'KPI 5' &'  =  '& Expression 5 & Chr(10) & Chr(10) &

  'KPI 6' &'  =  '& Expression 6 & Chr(10) & Chr(10)

alexandros17
Partner - Champion III
Partner - Champion III

Is this useful?

'KPI 1' &' = '& '111'

&
chr(10) & chr(10) &

'KPI 2' & ' = '& '222'

&
chr(10) & chr(10) &

'KPI 3' &' = '& '333'

&
chr(10) & chr(10) &

'KPI 4' &' = '& '444'

&
chr(10) & chr(10) &

'KPI 5' &' = '& '555'

&
chr(10) & chr(10) &

'KPI 6' &' = '& '666'

antoniotiman
Master III
Master III

=Repeat(' ',20)&'KPI Name'&Chr(10)&Chr(10)

&'KPI 1 = '&Expression&Chr(10)&Chr(10)

&'KPI 2 = '&Expression&Chr(10)&Chr(10)

&'KPI 3 = '&Expression&Chr(10)&Chr(10)

..............

Kushal_Chawda

something like this


  'KPI 1' &'   =  '& Expression 1 & Chr(13) &

  'KPI 2' &'  =  '& Expression 2 & Chr(13) &

  'KPI 3' &'  =  '& Expression 3 & Chr(13) &

  'KPI 4' &'  =  '& Expression 4 & Chr(13) &

  'KPI 5' &'  =  '& Expression 5 & Chr(13) &

  'KPI 6' &'  =  '& Expression 6 & Chr(13)

awhitfield
Partner - Champion
Partner - Champion

PS Chr(10) returns a linefeed character, just in case you ask!

Andy

Not applicable
Author

Thanks guys,

That's great. All the suggestions worked. Thank You!

But one last thing. The values are returned with over 5 decimal places (as a percentage). How do I restrict the values to only 2 decimal places for example? The expression I tried is as follows but it did not work...

=sum((Expression)*100,'#.00')