Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Bonjour,
Je suis face à une problématique un peu particulière... Je souhaiterai afficher la liste de mes clients ayant commandés au moins une fois dans les 18 derniers mois mais n'ayant pas commandé depuis 3 mois...
J'ai réalisé le set analysis suivant mais celui ne me donne pas les résultats escomptés...
Count({$<Date = {">=$(=MonthStart(Today()-540)) <= 1(=Today()-1)"}-{">=$(=MonthStart(Today()-90)) <= 1(=Today()-1)"},TYPE_FAITS={'COMMANDE_CLIENT'}>}K_Numéro_Cde)
Merci de votre aide..
--
Loic MASSON
Moi je propose une autre manière d'avoir l'info,
Et si dans le script, on essayait de creer une table des clients ayant passer au moins une commande il ya 18 mois.
ensuite creer une table des clients ayant passer au moins une commande il ya 3 mois.
Ensuite faire une jointure en entre les tables.
Par exemple,
Commande18:
Load distinct
ID_Client,
'Cd18 ' as flag_18Mois
from source where date_cde >= AddMonths(Today(),-18);
left join
Commande3:
Load distinct
ID_Client,
'Cd3 ' as flag_3Mois,
from source where date_cde >= AddMonths(Today(),-3);
Créons maintenant la table recherchée,
noconcatenate
Table18_03:
Load
ID_Client,
flag_18Mois,
flag_3Mois
Resident Commande18 where len(flag_3Mois)=0;
Drop table Commande18 ;
Moi je propose une autre manière d'avoir l'info,
Et si dans le script, on essayait de creer une table des clients ayant passer au moins une commande il ya 18 mois.
ensuite creer une table des clients ayant passer au moins une commande il ya 3 mois.
Ensuite faire une jointure en entre les tables.
Par exemple,
Commande18:
Load distinct
ID_Client,
'Cd18 ' as flag_18Mois
from source where date_cde >= AddMonths(Today(),-18);
left join
Commande3:
Load distinct
ID_Client,
'Cd3 ' as flag_3Mois,
from source where date_cde >= AddMonths(Today(),-3);
Créons maintenant la table recherchée,
noconcatenate
Table18_03:
Load
ID_Client,
flag_18Mois,
flag_3Mois
Resident Commande18 where len(flag_3Mois)=0;
Drop table Commande18 ;
Merci Almany pour cette réponse, je souhaitais plus de flexibilité pour l'utilisateur (en rajoutant une variable dans le set analysis par exemple) mais c'est déjà très bien...
et avec une table de période ?
Bonjour Luc,
Merci tout d'abord pour votre réponse, auriez vous un exemple car je ne vois pas trop comment je peux formaliser cette table de période dans mon script...
Merci d'avance
oui, ! après un peu de vacances et des problémes de licences, j'ai retrouvé l'exemple
appli en PJ avec fichier de données
LET vToday=today(1);
//
Périodes:
////
LOAD Période, date(evaluate(PériodeDébut)) as PériodeDébut, date(evaluate(PériodeFin)) as PériodeFin
;
LOAD * INLINE [
Période; PériodeDébut; PériodeFin
Aujourdhui; vToday; DayEnd(vToday)
Hier; vToday-1; DayEnd(vToday-1)
Cette_Semaine; WeekStart(vToday); WeekEnd(vToday)
Semaine_dernière; WeekStart(vToday,-1); WeekEnd(vToday, -1)
il_y_a_2_semaines; WeekStart(today(1),-1); WeekEnd(today(1))
Mois_en_cours; MonthStart(vToday); MonthEnd(vToday)
Mois_précédent; MonthStart(vToday,-1); MonthEnd(vToday,-1)
Mois-2; MonthStart(vToday,-1); MonthEnd(vToday)
Mois-3; MonthStart(vToday,-2); MonthEnd(vToday)
Mois-4; MonthStart(vToday,-3); MonthEnd(vToday)
Mois-5; MonthStart(vToday,-4); MonthEnd(vToday)
Mois-6; MonthStart(vToday,-5); MonthEnd(vToday)
Mois-7; MonthStart(vToday,-6); MonthEnd(vToday)
Mois-8; MonthStart(vToday,-7); MonthEnd(vToday)
Mois-9; MonthStart(vToday,-8); MonthEnd(vToday)
Mois-10; MonthStart(vToday,-9); MonthEnd(vToday)
Mois-11; MonthStart(vToday,-10); MonthEnd(vToday)
Mois-12; MonthStart(vToday,-11); MonthEnd(vToday)
Mois-13; MonthStart(vToday,-12); MonthEnd(vToday)
Mois-14; MonthStart(vToday,-13); MonthEnd(vToday)
Mois-15; MonthStart(vToday,-14); MonthEnd(vToday)
Mois-16; MonthStart(vToday,-15); MonthEnd(vToday)
Mois-17; MonthStart(vToday,-16); MonthEnd(vToday)
Mois-18; MonthStart(vToday,-17); MonthEnd(vToday)
Mois-19; MonthStart(vToday,-18); MonthEnd(vToday)
Mois-20; MonthStart(vToday,-19); MonthEnd(vToday)
Mois-21; MonthStart(vToday,-20); MonthEnd(vToday)
Mois-22; MonthStart(vToday,-21); MonthEnd(vToday)
Mois-23; MonthStart(vToday,-22); MonthEnd(vToday)
Cette_Année; YearStart(vToday); YearEnd(vToday)
Année_Dernière; YearStart(vToday,-1); YearEnd(vToday,-1)
] (delimiter is ';')
;
/*
*/
JOIN (Périodes) IntervalMatch (Date) LOAD PériodeDébut, PériodeFin RESIDENT Périodes;
// Because we did a JOIN, we may drop the the Start/End fields.
DROP FIELDS PériodeDébut, PériodeFin;
oups, j'ai au dessus, à moi même, par erreur 😉