Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
reinholdgraf
Contributor

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
Contributor

Re: Creating Mastercalendar (only month-end dates)

Solution:

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

Thanks for help.

Reinhold

3 Replies
MVP & Luminary
MVP & Luminary

Re: Creating Mastercalendar (only month-end dates)

You could try something like this:

LOAD

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

...

- Marcus

reinholdgraf
Contributor

Re: Creating Mastercalendar (only month-end dates)

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
Contributor

Re: Creating Mastercalendar (only month-end dates)

Solution:

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

Thanks for help.

Reinhold