Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
LP27
Creator II
Creator II

Stacked Bar chart with dates

Hi Everyone,

I have got the below table-

IDPR1PR2PR3PR4PR5PR6PR7
A00101/10/201901/20/201901/25/201901/27/201901/29/201902/02/201902/04/2019
B00201/15/201901/19/201901/25/201901/27/201902/03/201902/07/201902/07/2019
C00301/16/201901/17/201901/26/201901/30/201802/02/201902/18/201902/20/2019

 

Now i need to create a horizontal Stacked Bar chart. I have created the Stacked Bar Chart. 

But the issue is I am not getting the right format of dates in Stacked Bar chart, not sure what is the issue.

Please find the image attached to have a look at my Stacked Bar chart.

Please let me know if you have questions.

 

Thanks in advance! 

Labels (4)
28 Replies
LP27
Creator II
Creator II
Author

I need Stacked  Bar Chart as attached in image.

Like for each Id, i need to display the dates stacked from PR1 to PR7.

Note: if you observe the image, the date format is not in right format.

Kushal_Chawda

Instead sum use only function on Date fields

LP27
Creator II
Creator II
Author

I tried that as well. 

It dint work out well. 

Kushal_Chawda

I am worried without looking at your app it will be hard to tell what is the issue?

What is the dimension and measure used in the chart?

manoranjan_d
Specialist
Specialist

Hi

 

When coming to stacked bar the dates are getting summed up but in the non stacked the date format are correct. attached  the screen shot.

 

in the stacked bar chart the dates are sum up example

 

1/10/2019+ 1/20/2019+1/25/2019 = 2/26/2257

1/10/20191/20/20191/25/2019
Kushal_Chawda

use below expressions

=date(sum(PR1))...... for all expression

 

Go to chart properties -> appearance -> x-axis option -> Range -> Custom-> Min/Max

in Min: use min(PR1)

in Max: use max(PR7)

 

LP27
Creator II
Creator II
Author

It Should not Sum up. I want to have it like that only in stacked bar.

LP27
Creator II
Creator II
Author

I tried with date(sum(PR1))) and did the same expression till PR7, there is no change 😞

andoryuu
Creator III
Creator III

What are your DateFormat and TimestampFormat variables set to in your data load script?  Default US formatting is the following:

SET DateFormat='M/D/YYYY';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

That's what your data appears to be in, but if it's not you can either change your default date format or ensure the values are brought in as dates and then specify the format of the date thusly:

LOAD ID, DATE(DATE#(PR1,'M/D/YYYY'),'YourFormatString') as PR1;

SQL SELECT ID, PR1

FROM Table;

You may also want to floor your date if you are dealing with timestamps in the import (and want to group by date).

DATE(FLOOR(DATE#(PR1,'M/D/YYYY')),'YourFormatString') as PR1;

LP27
Creator II
Creator II
Author

I am using US Date format and there is no time stamp in my data.

I did not understand this part -

SQL SELECT ID, PR1

FROM Table;

Not sure how to scrip this!

Also in the below script , what do you mean by 'YourFormatString'

DATE(FLOOR(DATE#(PR1,'M/D/YYYY')),'YourFormatString') as PR1;

 

Thanks in advance!