Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
SaiPranathiG
Contributor II
Contributor II

Add space before field values

Hi All,

I had a requirement to add spaces for few field values.

For example, to add space before B, C, E in Category field

Category Year Sales($M)
A 2020 50
B 2021 28
C 2018 89
D 2017 78
E 2015 90
F 2019 80

 

expected output should be like below:

Category Year Sales($M)
A 2020 50
   B 2021 28
   C 2018 89
D 2017 78
   E 2015 90
F 2019 80

May i know how to achieve this in QS.

TIA

Labels (2)
1 Solution

Accepted Solutions
SaiPranathiG
Contributor II
Contributor II
Author

Space - Chr(160)

View solution in original post

3 Replies
Kushal_Chawda
MVP
MVP

@SaiPranathiG  you can use below as calculated dimension or in load script to create another field

=if(match(Category,'B','C','E'),Repeat(' ',5)&Category,Category)

SaiPranathiG
Contributor II
Contributor II
Author

I have tried the same before, but space is not adding before text. getting trimmed

SaiPranathiG
Contributor II
Contributor II
Author

Space - Chr(160)