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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Aspiring_Developer
Specialist
Specialist

Show segment labels in percentage and value labels as whole number

Hi , 

I wish to create a stack bar chart in qliksense like below :-

Aspiring_Developer_0-1654847899636.png

Is it possible to show value labels in whole number like above 409,967 and the segment labels is the percentage of totals ?

I have not done anything like this before . Can anyone please help ?

Thanks in advance

 

Labels (1)
1 Solution

Accepted Solutions
eddie_wagt
Partner - Creator III
Partner - Creator III

Hello  @Aspiring_Developer ,
It is not straight out of the box here, but you could hack the bar chart as follows.

I used this data as sample (you will have to adapt some of the expression to your own data)

 

Fact:
LOAD * Inline [MonthYear| Key|Value
Nov-20|1|36897,03
Nov-20|2|3794,06
Nov-20|3|299275,91
Sep-21|1|45293,4
Sep-21|2|64165,65
Sep-21|3|267985,95
] (delimiter is '|');

Dim:
LOAD * INLINE [Key, Name
1, Stack1
2, Stack2
3, Stack3];

 

1. Make a bar chart
2. Dimension 1: 
- Expression: =dual(aggr(sum(Value),MonthYear),MonthYear & ' '&aggr(sum(Value),MonthYear))
- Label: MonthYear

This will hide the MonthYear as label. If you don't want that you can also put this in the expression:

=MonthYear &' '&aggr(sum(Value),MonthYear)

3. Dimension 2:
- Expression: =ValueList('1','2','3')
- Label: Whatever you want
4. Measure
- Expression:
=pick(
match(ValueList('1','2','3'),1,2,3)
,num(1-sum({$<Name={Stack1}>}Value)/sum({1}Value),'#.##0%')
,num(1-sum({$<Name={Stack2}>}Value)/sum({1}Value),'#.##0%')
,num(1-sum({$<Name={Stack3}>}Value)/sum({1}Value),'#.##0%')
)
- Label: Whatever you want
5. Appearance - Presentation
- Segmentlabels on
- Valuelabels on
- Totallabels on
6. Appearance - X-axis
Position: Top

 

Result:

eddie_wagt_0-1654859941739.png

 

Kind regards

Eddie

If this answers your question or solves your issue, be sure to mark the answer as correct by clicking 'Accept as Solution'. This will mark the post as solved and other Qlikkies will gravitate towards this post as it as a possible solution for their issue. Multiple responses can be accepted as a solution so make sure to select all that apply.

View solution in original post

1 Reply
eddie_wagt
Partner - Creator III
Partner - Creator III

Hello  @Aspiring_Developer ,
It is not straight out of the box here, but you could hack the bar chart as follows.

I used this data as sample (you will have to adapt some of the expression to your own data)

 

Fact:
LOAD * Inline [MonthYear| Key|Value
Nov-20|1|36897,03
Nov-20|2|3794,06
Nov-20|3|299275,91
Sep-21|1|45293,4
Sep-21|2|64165,65
Sep-21|3|267985,95
] (delimiter is '|');

Dim:
LOAD * INLINE [Key, Name
1, Stack1
2, Stack2
3, Stack3];

 

1. Make a bar chart
2. Dimension 1: 
- Expression: =dual(aggr(sum(Value),MonthYear),MonthYear & ' '&aggr(sum(Value),MonthYear))
- Label: MonthYear

This will hide the MonthYear as label. If you don't want that you can also put this in the expression:

=MonthYear &' '&aggr(sum(Value),MonthYear)

3. Dimension 2:
- Expression: =ValueList('1','2','3')
- Label: Whatever you want
4. Measure
- Expression:
=pick(
match(ValueList('1','2','3'),1,2,3)
,num(1-sum({$<Name={Stack1}>}Value)/sum({1}Value),'#.##0%')
,num(1-sum({$<Name={Stack2}>}Value)/sum({1}Value),'#.##0%')
,num(1-sum({$<Name={Stack3}>}Value)/sum({1}Value),'#.##0%')
)
- Label: Whatever you want
5. Appearance - Presentation
- Segmentlabels on
- Valuelabels on
- Totallabels on
6. Appearance - X-axis
Position: Top

 

Result:

eddie_wagt_0-1654859941739.png

 

Kind regards

Eddie

If this answers your question or solves your issue, be sure to mark the answer as correct by clicking 'Accept as Solution'. This will mark the post as solved and other Qlikkies will gravitate towards this post as it as a possible solution for their issue. Multiple responses can be accepted as a solution so make sure to select all that apply.