Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
reinholdgraf
Creator
Creator

Creating Mastercalendar (only month-end dates)

Hi.

I use the following approach to create a MasterCalendar:

//--------------------------------------------------------//

//----- MasterCalendar für Lagerbestand -----//

//--------------------------------------------------------//

[Datum_LB]:

// Datumsfelder zusammenstellen

LOAD

    "%TempDatum" AS "%LB_Datum", // Datum;

   

// TempCalendar erstellen

LOAD

  Date(mindate + IterNo(), 'YYYYMMDD') AS "%TempDatum",

  maxdate

While mindate + IterNo() <= maxdate;

// Min/Max-Datum holen

Load

  min(FieldValue('%LB_Datum', recno()))-1 as mindate,

    max(FieldValue('%LB_Datum', recno())) as maxdate

AutoGenerate FieldValueCount('%LB_Datum');

Incoming Data only has month-end dates, so that all the other dates inbetween, created in the MasterCalendar, are obsolete.

Does anyone have an idea how to solve this problem ?

Reinhold

1 Solution

Accepted Solutions
reinholdgraf
Creator
Creator
Author

Solution:

Leave the floor()-statement, than the script works fine.

Thanks for help.

Reinhold

View solution in original post

3 Replies
marcus_sommer

You could try something like this:

LOAD

    "%TempDatum" AS "%LB_Datum" where "%TempDatum" = date(floor(monthend("%TempDatum")), 'YYYYMMDD');

...

- Marcus

reinholdgraf
Creator
Creator
Author

ok - this is working.

But all other fields in the fieldlist except the first one (%LB_Datum") are now not loaded / calculated anymore. They are all empty.

Code-Snippet:

LOAD

    "%TempDatum" AS "%LB_Datum", // Datum

    "%TempDatum" & '-Test' as "test",

    date(%TempDatum,'DD.MM.YYYY') AS "LB_Datum/Date",

    .

    .

    .

    where "%TempDatum" = date(floor(monthend(%TempDatum)),'DD.MM.YYYY');

Most likely, I have to adjust my script further... ?

ADD:

as it seems, the load-script does not work (called lines: 0)

Reinhold

reinholdgraf
Creator
Creator
Author

Solution:

Leave the floor()-statement, than the script works fine.

Thanks for help.

Reinhold