Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello.
My objective is to achieve ... YTD and LYTD so that I can later on calculate differences and % and so on...
I can not get the link between a master calendar.... or the QlikViewcomponents ... and the fact-table.
I guess it is because my fact-table is year_month level and both master calendar options are supposed to work on day level???
I have tries to concatenate the year_month with '01' so that I get a YYYYMMDD.. but...
I have tried 2 ways:
1.- With this generated master calendar I found
Let vStartDate=Floor(MakeDate(2000,1,1));
Let vEndDate=Floor(Today());
Let vDiff=vEndDate-vStartDate+1;
Calendar:
Load *,
Date(MonthStart(DateID), 'YYYYMM') AS "Año_Mes_Calendar",
Year & '-' & Quarter As YearQuarter,
WeekYear & '-' & Num(Week, '00') As YearWeek;
Load
DateID,
Year(DateID) As Year,
Month(DateID) As Month,
Date(DateID) As Date,
Day(DateID) As Day,
Week(DateID) As Week,
'Q' & Ceil(Month(DateID)/3) As Quarter,
WeekYear(DateID) As WeekYear,
-Year2Date(DateID) As YTD_Flag,
-Year2Date(DateID, -1) As LYTD_Flag;
Load
RecNo()-1+$(vStartDate) As DateID
AutoGenerate($(vDiff));
2.- With the Qlikview Components (Qvc) from Rob Wunderlich.
http://qlikviewcookbook.com/2012/01/easy-period-analysis-using-qlikview-components/
Add this include at the beginning of the script to bring in the Qvc routines.
$(Include=..qvc_runtimeqvc.qvs);
After loading the fact table, generate a Master Calendar with this call:
CALL Qvc.CalendarFromField(‘OrderDate’);
but it gives me error and I guess is because of something in the dateformat..
https://groups.google.com/forum/#!topic/qlikview-components-users/w12HXCYtQx0
I try this
Date(Date#(factdate, 'YYYYMMDD')) as factdate
but it gives me this error....
Connector reply error: Unable to get column information for the fields that are used in the query:
ERROR [42000] [Qlik][ODBC Oracle Wire Protocol driver][Oracle]ORA-00923: FROM keyword not found where expected
I solved the date-format issue.. but now.... trying to CALL the QVC gives me these:
Autogenerate: generate count is out of range
LOAD FieldValue('', recno()) as [] AUTOGENERATE FieldValueCount('')
Table not found
DROP table _qvctemp.temptab
Autogenerate: generate count is out of range
LOAD date('' + recno() - 1) as Date,
date('' + recno() - 1) as _qvctemp.Date
AUTOGENERATE date('') - date('') + 1
_qvctemp.Calendar.EscapeCharsMap << cbd43348-4b1a-47db-824f-998022d6502c 2 Lines fetched
FOR _qvctemp.i = 1 to NoOfFields('MasterCalendar')
Unexpected token: ',', expected one of: '(', 'ZTestw_z', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'not', 'bitnot', 'LITERAL_NUMBER', ...
LET _vClearFieldList = '' & '[' & FieldName(>>>>>>,<<<<<< 'MasterCalendar') & ']=,'
The control statement is not correctly matched with its corresponding start statement
NEXT _qvctemp.i
FOR _qvctemp.i = 1 to NoOfFields('MasterCalendar') // Loop through all fields in Calendar table
Unexpected token: ',', expected one of: '(', 'ZTestw_z', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'not', 'bitnot', 'LITERAL_NUMBER', ...
LET _qvctemp.vFname = FieldName(>>>>>>,<<<<<< 'MasterCalendar')
The control statement is not correctly matched with its corresponding start statement
NEXT _qvctemp.i
DM_FC_PLANTILLA << QueryResult 6.124 Lines fetched
DM_DM_EMPLEADO << QueryResult 3.903 Lines fetched
DM_DM_SEXO << QueryResult 2 Lines fetched
DM_DM_TIPO_CONTRATO << QueryResult 2 Lines fetched
DM_DM_EMPRESA << QueryResult 14 Lines fetched
DM_DM_HOTEL << QueryResult 16 Lines fetched
DM_DM_DEPARTAMENTO << QueryResult 97 Lines fetched
DM_DM_PUESTO_CATEGORIA_CG << QueryResult 470 Lines fetched
DM_DM_STATUS_EMPLEADO << QueryResult 3 Lines fetched