New Line (force wrap) in pivot cell

I have table I don’t want to show 3 levels of columns. I have a calculated field that aggregates the three keys as 1 column as a hidden sort key. {A}{B}{C}

Now I want to place in the 2nd column unhidden the 3 hierarchy names wrapped in the cell on new lines. So in the first visual cell:
“Level A”: {A}
“Level B”: {B}
“Level C”: {C}

Providing a function returning (“Level A”: {A}\n"Level B": {B}\n"Level C": {C}) doesn’t work.
These can be longer descriptions and I’ll never know how long they are, so I need wrapping and some way to force a new line.

Hey sirwin007,

I don’t think this is possible via quicksight.

However, if you can transfer that calculated field into SQL, you could do something where you union and create three new rows. Then you could group those rows by the unique id.

I might look like this.

Select *,“Level A”:{A} level from view
UNION
Select *,“Level B”:{B} level from view
UNION
Select *,“Level C”:{C} level from view

It actually does work, just not for me. I opened a support case. I was given a working demo and I replicated the simple code.

@sirwin007 how about something like this?

concat("Level A: ", {A} , "

", "Level B: ", {B}, "

", "Level C: ", {C})

Seemed to work for me (maybe Im misunderstanding your question though…)

image

(ignore the color coding in the calc field editor - seems it is not picking up the new line as a continuation of the previous string, but the result still works as intended)

Yes that worked! The demo given used the literal value ‘\n’ in the concat. But thanks - on to the next issue…

1 Like