Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Daten nachträglich datumsabhängige Informationen zuordnen

Liebe Community,

ich bin QV-Beginner und habe folgendes Problem:

Ich möchte Daten nachträglich datumsabhängige Informationen zuordnen.

Beispiel:

Die datumsbezogenen Verkäufe eines Artikel liegen vor.

dat_verkauf:

ArtNrVerkaufDatum
131.12.2012
101.01.2013
102.01.2013

Die datumsabhängigen Preise des Artikels liegen ebenfalls vor.

sta_preise:

ArtNrAbDatumPreis
131.12.201210€
101.01.201320€

Wie kann ich den verkauften Artikeln, nun die zum Zeitpunkt des Verkaufs gültigen Preise zuordnen?

dat_verkauf:

ArtNrVerkaufDatumPreis
131.12.201210€
101.01.201320€
102.01.201320€

Hat hierzu jemand ein Code-Snippet in petto?

Vielen Dank im Voraus!

Dirk

1 Solution

Accepted Solutions
Nicole-Smith

Load Script:

Beispiel:

LOAD * INLINE [

    ArtNr, VerkaufDatum

    1, 31.12.2012

    1, 01.01.2013

    1, 02.01.2013

];

sta_preise_temp:

LOAD * INLINE [

    ArtNr, AbDatum, Preis

    1, 31.12.2012, 10€

    1, 01.01.2013, 20€

];

sta_preise:

LOAD ArtNr, AbDatum as FromDate, if(ArtNr = previous(ArtNr), date(previous(AbDatum)-1), date(today())) as ToDate, Preis

RESIDENT sta_preise_temp

ORDER BY AbDatum DESC;

DROP TABLE sta_preise_temp;

Inner Join

IntervalMatch(VerkaufDatum,ArtNr)

LOAD FromDate, ToDate, ArtNr

RESIDENT sta_preise;

Example file also attached.

View solution in original post

5 Replies
Gysbert_Wassenaar

Sehe How to populate a sparsely populated field


talk is cheap, supply exceeds demand
Nicole-Smith

Load Script:

Beispiel:

LOAD * INLINE [

    ArtNr, VerkaufDatum

    1, 31.12.2012

    1, 01.01.2013

    1, 02.01.2013

];

sta_preise_temp:

LOAD * INLINE [

    ArtNr, AbDatum, Preis

    1, 31.12.2012, 10€

    1, 01.01.2013, 20€

];

sta_preise:

LOAD ArtNr, AbDatum as FromDate, if(ArtNr = previous(ArtNr), date(previous(AbDatum)-1), date(today())) as ToDate, Preis

RESIDENT sta_preise_temp

ORDER BY AbDatum DESC;

DROP TABLE sta_preise_temp;

Inner Join

IntervalMatch(VerkaufDatum,ArtNr)

LOAD FromDate, ToDate, ArtNr

RESIDENT sta_preise;

Example file also attached.

Not applicable
Author

Vielen Dank!

Not applicable
Author

Hi Nicole,

I have found a small bug in your scripts:

sta_preise:

LOAD ArtNr, AbDatum as FromDate, if(ArtNr = previous(ArtNr), date(previous(AbDatum)-1), date(today())) as ToDate, Preis

RESIDENT sta_preise_temp

ORDER BY ArtNr, AbDatum DESC;

 

Thank you again!

Kind regards

Dirk

Nicole-Smith

Good catch!  I missed that one.