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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a false calendar

Der all,

I read in one of the forum topics that it is posible to create a false calendar and link data from an existing calendar, so dates without any data are shown in the graf.

Can somebody explain me how to create a false calendar and how to conect it to the other one. Thanks in advance.

Patrick

1 Reply
Not applicable
Author

You could do something like bellow. Just remember to change the charts so that zero-values are shown (on the Presentation tab).

// Some orders
DataTable:
LOAD OrderNo, date#(Date,'YYYY-MM-DD') as Date, Value INLINE [
OrderNo, Date, Value
1, 2009-10-12, 27
2, 2010-01-04, 37
3, 2010-12-10, 34
4, 2009-05-08, 82
5, 2009-06-08, 18
];

// Find max and min dates
MaxMin:
Load
max(Date) as maxDate,
min(Date) as minDate
resident DataTable;

// Put in variables
Let minDate = FieldValue( 'minDate', 1 );
Let maxDate = FieldValue( 'maxDate', 1 );

// Create temp and calculate all dates between min and max
Calendar_tmp:
Load
date($(minDate)+RowNo()-1) as Date
autogenerate($(maxDate)-$(minDate)+1);

// Calculate month, year, etc
Calendar:
Load
Date,
month(Date) as Month
// And so on...
resident Calendar_tmp;
drop table Calendar_tmp;