Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Master Calendar issue

Hi Guys,

I am stuck in defining the Min and Max date (last load statement) while making the master calendar. Someone an idea?

My Excel  files shows dates as follows: "December 2016 Final" (this is one cell)

-------------------------------------------------------------------

RepMonth:

Load Date(Date#(SubField("[$C].[Reporting Date]",' ',1),'MMMM'),'MMM') as Month,
SubField("[$C].[Reporting Date]",' ',2) as Year

from [..\Data Files\HR-Cube\*.xlsx]
(
ooxml, embedded labels);


MasterCalendar:

Load Date("[$C].[Reporting Date]") AS [Reporting Month],
Year("[$C].[Reporting Date]") AS Year,
'Q'&
Ceil (Month(("[$C].[Reporting Date]")) / 3) AS Quarter,
Month("[$C].[Reporting Date]") As Month,
Day("[$C].[Reporting Date]") As Day,
Week("[$C].[Reporting Date]") As Week;

Load
Date(MinDate + IterNo() -1 ) As "[$C].[Reporting Date]"
While (MinDate + IterNO() -1) <= Num(MaxDate);

Load
Min(date(Date#("[$C].[Reporting Date]"))) as MinDate,
Max(date(Date#("[$C].[Reporting Date"))) as MaxDate
RESIDENT RepMonth ;

-------------------------------------------------------------------

1 Solution

Accepted Solutions
Not applicable
Author

Was able to fix it yesterday:

I've changed the code into the following:

///////////////////////////////////////////////////////////////////////////////

RepMonth:

Load "[$C].[Reporting Date]" As [Reporting Month]

from [..\Data Files\HR-Cube\*.xlsx]
(
ooxml, embedded labels);


MasterCalendar:

Load Date("[$C].[Reporting Date]") AS [Reporting Month],
Year("[$C].[Reporting Date]") AS Year,
'Q'&
Ceil (Month(("[$C].[Reporting Date]")) / 3) AS Quarter,
Month("[$C].[Reporting Date]") As Month;

Load
Date(MinDate + IterNo() -1 ) As "[$C].[Reporting Date]"
While (MinDate + IterNO() -1) <= Num(MaxDate);

Load
Min (Date(Date#(SubField([Reporting Month],' ',1),'MMM'),'MMM')) as MinDate,
Max (Date(Date#(SubField([Reporting Month],' ',1),'MMM'),'MMM')) as MaxDate,
Min (Date(Date#(SubField([Reporting Month],' ',2),'YYYY'),'YYYY')) as MinDate,
Max (Date(Date#(SubField([Reporting Month],' ',2),'YYYY'),'YYYY')) as MaxDate



RESIDENT RepMonth;
///////////////////////////////////////////////////////////////////////////////

View solution in original post

16 Replies
micheledenardi
Specialist II
Specialist II

In Your last load statement you had forgot some ) and ]


Load
Min(date(Date#("[$C].[Reporting Date]"))) as MinDate,
Max(date(Date#("[$C].[Reporting Date]"))) as MaxDate
RESIDENT RepMonth ;

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
its_anandrjs

Try your last code this way

Load

Min(date(Date#("[$C].[Reporting Date]"))) as MinDate,

Max(date(Date#("[$C].[Reporting Date]"))) as MaxDate

RESIDENT RepMonth ;

Regards

Anand

Anonymous
Not applicable
Author

Check Closing parenthesis " )" missing in last load statement. Give and try once

Not applicable
Author

Thanks Guys, still not working out though. I get a table not found errror

Anonymous
Not applicable
Author

Attach sample file

prieper
Master II
Master II

Check your spelling. Seems that formula refers to a name, which does not exist.

Not applicable
Author

Can't upload file unfortunately as I am @ work.

But it's quite simple. The script above is the only script I am using and its linking directly with the excel file. The name matches as presented in the Excel and I am only getting an error at the last load statement.

Script is a direct copy (where I amended the necessary fields). It could be that there are codes that shouldn't be there.


Most important is that dates in Excel are displayed as "December 2016 Final hence the load statement @ top

prieper
Master II
Master II

The Table RepMonth does not have the field "[$C].[Reporting Date]" included, you load only Year and Month.

Not applicable
Author

Still getting following error:

-------------------------------------------------------------------------------

Field not found - <[$C].[Reporting Date]>

Load

Min(date(Date#("[$C].[Reporting Date]"))) as MinDate,

Max(date(Date#("[$C].[Reporting Date"))) as MaxDate

RESIDENT RepMonth

---------------------------------------------------------------------------------