Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Contributor

How to insert a line break between 2 values in a bar chart ? (qlikview)

Hi the community,

Is it possible to insert a line break between the 2 values in a bar chart ?

Here I  use  the expression :

=dual(num(sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000),'#0 M') &
' (' & num(
(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2]),'##.0%') & ')',

num(sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000) )
+(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2]) )

I thought i could use "&chr(10)&", but it does not work.

Any idea ?

Thank you for your help.
bar chart.PNG

Labels (1)
2 Solutions

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Usually it worked in this way. Did you try:

=dual(num(sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000),'#0 M') & chr(10) &
num(
(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2]),'(##.0%)'),

sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000)
+(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2])))

- Marcus

View solution in original post

Highlighted
MVP & Luminary
MVP & Luminary

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Maybe this behaviour is release-dependent - for me in QV 11.2 it worked. To exclude any problems with your specific chart and any possible issues in regard to the settings there - create a new one with any small dimension maybe years and an expression like:

dual('a' & chr(10) & 'b' & chr(13) & 'c' & chr(10) & chr(13) & 'd', 1)

If this worked just add a second dimension and choose stacked bars and further settings step by step and you will see if any of these steps prevent the linebreak.

- Marcus

View solution in original post

8 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Usually it worked in this way. Did you try:

=dual(num(sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000),'#0 M') & chr(10) &
num(
(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2]),'(##.0%)'),

sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000)
+(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2])))

- Marcus

View solution in original post

Highlighted
Contributor

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Hello Marcus,

Yes i tried it but it does not work.

Highlighted
MVP & Luminary
MVP & Luminary

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

What happens - no change, an error with the bars/values, wrong values or anything else? The number-format from tab Numbers is on expression?

Highlighted
Contributor

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

the error message is "no data to display"

bar chart result.PNG

Highlighted
Contributor

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Regarding the format, in the properties => 'default format' is selected

 

Highlighted
MVP & Luminary
MVP & Luminary

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Ok, remove the last bracket from the expression which is too much for a valid syntax. I was confused from all your brackets and didn't saw that the second sum() within the numeric-part was additionally wrapped with brackets - in this way they are superfluous. Are you sure that the 3 sum() parts are calculated in the wanted order?

- Marcus

Highlighted
Contributor

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Yes i had already removed the bracket.

Now the expression is

 

 

=dual(num(sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000),'#0 M') & chr(10) &
num(
(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2]),'(##.0%)')
,

sum( {$<Année=, Mois=, Média>}[ts Visites_supp2]/1000000)
+(sum({$<Année=, Mois=, Média>}[ts Visites_supp2]))/sum( {$<Année=,Mois=,Média=>} TOTAL <Année>[ts Visites_supp2]))

and does not work.

 

I confirm you that the expression first calculates the Millions of visites in this format  '#0 M'.

Then it calculates the % of visits .

Thank you for your help.

Highlighted
MVP & Luminary
MVP & Luminary

Re: How to insert a line break between 2 values in a bar chart ? (qlikview)

Maybe this behaviour is release-dependent - for me in QV 11.2 it worked. To exclude any problems with your specific chart and any possible issues in regard to the settings there - create a new one with any small dimension maybe years and an expression like:

dual('a' & chr(10) & 'b' & chr(13) & 'c' & chr(10) & chr(13) & 'd', 1)

If this worked just add a second dimension and choose stacked bars and further settings step by step and you will see if any of these steps prevent the linebreak.

- Marcus

View solution in original post