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: 
fred_randon
Contributor III
Contributor III

Tarif à une date donnée

Bonjour à tous,

pour établir un bordereau de facturation de produits j'ai besoin de calculer prix*quantité.

Mais le prix peut varier dans le temps.

Pour le moment j'ai donc une table des ventes liée par un code_produit à une table des tarifs. Cette dernière table contient une date_début_tarif et une date_fin_tarif.

Tarifs :

code_produitprixdate_debut_tarifdate_fin_tarif
P11001/01/201531/08/2016
P11201/09/201631/12/2999
P24501/01/201531/12/2999

Ce que je souhaite c'est ajouter un champ prix_calculé à ma table des ventes, qui contiendra le prix du produit à la date de la vente.

ex:  si je vends un P1 le 05/01/2018 je voudrais que l’enregistrement correspondant dans la table des ventes ressemble à :

ChampValeur
date_vente05/01/2018
code_produitP1
...
...
prix_calculé12

j'ai tenté sans succès de trouver mon bonheur dans le fonctions de type peek.

j'ai besoin d'aide svp!

merci.

1 Solution

Accepted Solutions
sfatoux72
Partner - Specialist
Partner - Specialist

ça donne ça avec l'intervalMatch --> Voir appli QlikView en pièce jointe.

Voici le script utilisé :

SET DateFormat='DD/MM/YYYY';

Tarifs:
LOAD code_produit,
prix,
date_debut_tarif,
date_fin_tarif
FROM
[https://community.qlik.com/message/1412134?et=watches.email.thread#1412134]
(
html, utf8, embedded labels, table is @1);


Ventes:
LOAD * Inline [
code_produit, date_vente
P1, 05/01/2018
P1, 05/01/2016
]
;


Left Join(Ventes)
IntervalMatch( date_vente, code_produit )
LOAD date_debut_tarif, date_fin_tarif, code_produit
Resident Tarifs;


Left Join(Ventes)
LOAD code_produit,
date_debut_tarif,
date_fin_tarif,
prix
Resident Tarifs;

DROP Table Tarifs;
DROP Field date_debut_tarif;
DROP Field date_fin_tarif;

View solution in original post

7 Replies
christophebrault
Specialist
Specialist

Bonjour,

Désolé pas le temps de formuler une réponse complète, mais ce que tu cherches à faire doit être réalisé avec la fonction intervalmatch :

https://help.qlik.com/en-US/sense/November2017/Subsystems/Hub/Content/Scripting/ScriptPrefixes/Inter...

Inscrivez vous à ma Newletter Qlik
DoNotMissQlik- Connect with me on Linkedin
sfatoux72
Partner - Specialist
Partner - Specialist

ça donne ça avec l'intervalMatch --> Voir appli QlikView en pièce jointe.

Voici le script utilisé :

SET DateFormat='DD/MM/YYYY';

Tarifs:
LOAD code_produit,
prix,
date_debut_tarif,
date_fin_tarif
FROM
[https://community.qlik.com/message/1412134?et=watches.email.thread#1412134]
(
html, utf8, embedded labels, table is @1);


Ventes:
LOAD * Inline [
code_produit, date_vente
P1, 05/01/2018
P1, 05/01/2016
]
;


Left Join(Ventes)
IntervalMatch( date_vente, code_produit )
LOAD date_debut_tarif, date_fin_tarif, code_produit
Resident Tarifs;


Left Join(Ventes)
LOAD code_produit,
date_debut_tarif,
date_fin_tarif,
prix
Resident Tarifs;

DROP Table Tarifs;
DROP Field date_debut_tarif;
DROP Field date_fin_tarif;

fred_randon
Contributor III
Contributor III
Author

Salut Christophe, merci pour ta réponse! Si j'en crois l'aide, on dirait bien que c’est ça qu'il me faut en effet! merci beaucoup

fred_randon
Contributor III
Contributor III
Author

, avec l'appli en plus? Avec un délai de réponse d'une demi heure chrono?

Chapeau et surtout merci beaucoup, ça va m'aider à comprendre cette fonction.

Vive la connaissance libre au service des autres!

cyrzouhon
Contributor III
Contributor III

Frédéric c'est la réponse de Sébatien tu dois mettre en correcte si non ça peut tromper ceux qui auront besoin d'un truc pareil dans le futur

fred_randon
Contributor III
Contributor III
Author

ah oui, je me suis trompé! C'est réparé, merci Cyrille.

cyrzouhon
Contributor III
Contributor III

T'inquiète. l'erreur est humaine.