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: 
guillaume_gorli
Creator II
Creator II

Créer une variable directement dans le script (simple addition de variables existantes)

Bonjour à tous,

Je travaille sur deux base de données distinctes.

Une première remonte l’ensemble des ventes avec les champs ci-dessous :

Capture.JPG

Une seconde base remontant les mêmes variables si ce n'est que la variable "Sales" est remplacée par une variable "Avoir" correspondant aux avoirs émis aux clients et la variable Code article disparaît.

Capture.JPG

Je souhaite remonter pour chaque mois la facturation totale comprenant donc les ventes + les avoirs éventuels.

Je souhaiterai pour cela créer une nouvelle variable directement dans le script correspondant à Sum (Sales) + Sum (Avoir) ceci afin de ne pas surcharger mes différentes formules plus loin dans l'application. Je croise toutes ces données dans différents graph en intégrant de nombreuses autres variables comme par exemple le le type cde et le secteur dans cet exemple, travailler avec une somme de deux variables dans les différents graph entraîne assez des formules à rallonge.

Par exemple le "produit final" devrait ressembler à quelque chose comme cela :

Capture.JPG

Je joint les deux bases test sou excel et le .qvw pour ceux qui souhaiteraient aider.

Merci

Guillaume

Labels (1)
17 Replies
maxgro
MVP
MVP

sum({$ <Secteur={31}>} Sales)+sum({$ <Secteur={31}>} Avoir)

guillaume_gorli
Creator II
Creator II
Author

MG,

I would like (if possible) to avoid using sum of different variables (like sum({$ <Secteur={31}>} Sales)+sum({$ <Secteur={31}>} Avoir)) but rather a formula using the (vFormule) variable as i need in the application to produce many kinds of charts based on a lot of conditions / restrictions (total sales, total sales year -1, total sales year to date, total sales for secteur, for business, for client, etc...). Using addition of variable to get the "total sales" lead me to too much complicated formulas later on the application.

Any luck sum({$ <Secteur={31}>} Sales)+sum({$ <Secteur={31}>} Avoir) could be replaced by someting like $({$ <Secteur= {31}>}vFormule) ?

Thanks

Guillaume

maxgro
MVP
MVP

try using variable with parameters

Variables with Parameters

Re: Variables with Parameters

guillaume_gorli
Creator II
Creator II
Author

Thanks for your help MG but i am afraid i have no idea how to use variables with parameters based on the links you provided.

I guess i will create a new topic summing up the complete application i need to build and the final results i have to get. I realize i am facing several issues there.

Guillaume

maxgro
MVP
MVP

in the attachment, sheet1

cje
Employee
Employee

Bonsoir Guillaume,

Pour reprendre ta demande à la base :

- Oui, il est possible de créer des variables contenant des formules simples dans le script de chargement. Ces variables pourront ensuite être reprises dans l’appli pour choisir des formules différentes selon les besoins. Cf appli d’exemple en pièce jointe.

- Oui, il est possible de créer une variable qui serait l’équivalent d’une fonction avec passage de paramètres à la variable. Un truc du genre Set mavar(param1 ,param2)=’ma formule’. Je l’ai déjà vu, je vais essayer de te retrouver un exemple.

Cdt

Christophe Jouve

Principal Solution Architect

Direct: +33 1 55 62 65 54

Mobile: +33 6 76 24 22 47

Email: Christophe.Jouve@qlik.com

Qlik

France Headquarters Office,93 avenue Charles de Gaulle

92200 Neuilly sur Seine

qlik.com<http://www.qlik.com/>

Téléchargez gratuitement QlikView

http://www.qlikview.com/fr/explore/experience/free-download

<http://global.qlik.com/qonnections-2016/?SourceID1=Corporate_Email_Signature>

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

cje
Employee
Employee

Pour faire suite à mon précédent mail, voici un exemple d’utilisation de variables avec des paramètres.

Cf. le lien ci-dessous et l’exemple en pièce jointe.

Cdt

https://community.qlik.com/docs/DOC-9045

Christophe Jouve

Principal Solution Architect

Direct: +33 1 55 62 65 54

Mobile: +33 6 76 24 22 47

Email: Christophe.Jouve@qlik.com

Qlik

France Headquarters Office,93 avenue Charles de Gaulle

92200 Neuilly sur Seine

qlik.com<http://www.qlik.com/>

Téléchargez gratuitement QlikView

http://www.qlikview.com/fr/explore/experience/free-download

<http://global.qlik.com/qonnections-2016/?SourceID1=Corporate_Email_Signature>

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

cje
Employee
Employee

Autre lien pour bien comprendre le fonctionnement du symbole $.

https://hyunkucho.wordpress.com/2012/04/14/qlikview-dollar-sign-expansions/

cdt

Christophe Jouve

Principal Solution Architect

Direct: +33 1 55 62 65 54

Mobile: +33 6 76 24 22 47

Email: Christophe.Jouve@qlik.com

Qlik

France Headquarters Office,93 avenue Charles de Gaulle

92200 Neuilly sur Seine

qlik.com<http://www.qlik.com/>

Téléchargez gratuitement QlikView

http://www.qlikview.com/fr/explore/experience/free-download

<http://global.qlik.com/qonnections-2016/?SourceID1=Corporate_Email_Signature>

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.