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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Manish
Creator
Creator

Stacked bar chart Issue in qlik sense

Hi

Is there any way I can create a chart as below in Qlik sense? 

Same chart I have create in Qlikview by using 2 dimensions and 4 expressions as below

Dim1 : Date

Dim 2 : Valuelist(1,2)

Exp1: If (Valuelist(1,2) = 2, Sum(A))

Exp2: If (Valuelist(1,2) = 2, Sum(B))

Exp3: If (Valuelist(1,2) = 1, Sum(C))

Exp4: If (Valuelist(1,2) = 1, Sum(D))

Note: Need expression labels in legends

Manish_0-1738155402225.png

 

Labels (2)
3 Replies
JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @Manish 
As soon as you add 2 dimensions using the bar chart you can only add 1 measure, but using 1 dimension you can add multiple measures.

Below is my result - I needed to add the ValueList values to the actual Dimesion to force "2 values" for the same month, Not really pretty but it works

JandreKillianRIC_0-1738226049339.png

 

Here is my script 

Table:
Load 
	Date(Date, 'MMM YYYY') as Date,
    A, 
    B,
    C,
    D;
Load * Inline [
Date,A,B,C,D
45292,87,38,4,19
45323,53,77,7,9
45352,67,22,13,8
45383,43,51,7,8
45413,38,20,20,19
45444,14,53,17,1
45474,30,56,5,12
45505,70,42,8,11
45536,92,62,13,4
45566,62,37,9,17
45597,89,29,5,20
45627,10,58,7,11
];

ValueListTmp: //Creating a single dimensio that has valuelist(1,2) added
Load 
	Distinct Date
Resident Table;

Join (ValueListTmp)
Load 
	RecNo() as ValueList
AutoGenerate(2); // This will give us 2 values

ValueList:
Load 
	Date, 
    Date&' '&ValueList as Dimesion, 
	ValueList
Resident ValueListTmp;

Drop Table ValueListTmp; 


 

Measures are just like you had them 

JandreKillianRIC_1-1738226127930.png

 

Regards Jandre

 

 

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

Manish
Creator
Creator
Author

Hi Jandre

Many thanks for your reply. Really appreciate it .

This is very close to what I want.

Can we have a single month year values instead of every month year coming twice?

For example, instead of Dec 2024 1 & Dec 2024 2 , can we have only Dec 2024 ?

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @Manish 

Unfortunately not, Then if will revert back to 1 Dimension per bar and you wont get that split. 

You might be able to use spaces... like 1 space (As ValueList 1 and 2 spaces as ValueList 2) This will still show Jan 2024 (Twice) but not have the Jan 2024 1 and Jan 2024 2. 

Regards Jandre

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn