Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
francois_974
Contributor III
Contributor III

variable in script for specific treatement

Hello all

Using Qliksense business for a short time, I'm trying to write a variable but perhaps i'm wrong with what i'm doing.

My case : in the script below, i want to separate in a specific variable the sum of  "Mt Sortie (mvs)" for "No UF (mvs)"=' 6423'.

first i do is not a good solution but it work.

1 - i load my data with a where  clause  "No UF (mvs)"=' 6423'  and rename "Mt Sortie (mvs)" as "Mt Sortie (mvs)" mtBonimali

2 - i concatenate and the i load again the same data with a where clause "No UF (mvs)"<>'6423' 

 I would like to create a variable to calcule separatly the sum of Mt Sortie Bonimali but all i try don't works

SET vMtBonimali =  sum({<"No UF (mvs)"=' 6423'>}Mt Sortie (mvs)") but it don't works  , i try also 

 SET UFBonimali =  <"No UF (mvs)"=' 6423'> and then

SET vMTEBonimali =sum($(vBonimali) Mt Sortie (mvs)") 

But perhaps it's not the good way 

 

LOAD
"Magasin (mvs)",
"Libellé magasin (mvs)",
"Type (mvs)",
"code - libellé pole (po)",
"No UF (mvs)",
"libelle Uf - code UF (uf)",
"No Produit (pr)",
"Libelle1 Produit (pr)",
"Libelle2 Produit (pr)",
"Compte Ordonnateur (pr)",
"Libellé Compte",
"Date Mouvement (mvs)",
"Qté Mvt (mvs)",
"Mt Sortie (mvs)",
"No Fournisseur (fr)"
FROM [lib://Test Espace magasin:DataFiles/_All MouvementsStock2020.xlsx]
(ooxml, embedded labels, table is Mouvements);

Thanks for your help

Francois

 

 

 

 

Labels (1)
  • SaaS

1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

You were close on your first attempt.  Just missing a "  before Mt Sortie (mvs.  Try this:

SET vMtBonimali =  sum({<"No UF (mvs)"=' 6423'>} "Mt Sortie (mvs)") 

View solution in original post

4 Replies
GaryGiles
Specialist
Specialist

You were close on your first attempt.  Just missing a "  before Mt Sortie (mvs.  Try this:

SET vMtBonimali =  sum({<"No UF (mvs)"=' 6423'>} "Mt Sortie (mvs)") 

francois_974
Contributor III
Contributor III
Author

Hi @GaryGiles

i think a bug apply when i reply .. so sorry for my late answers. 

i have corrected my variable but it doesn't works anymore when i'm doing 

=Sum(vMtBonimali)  or =$(vMtBonimali)

am i doing somethong wrong? 

thanks for helping

GaryGiles
Specialist
Specialist

Was missing {} brackets.  Try this:

SET vMtBonimali =  sum({<"No UF (mvs)"={' 6423'}>} "Mt Sortie (mvs)") 

francois_974
Contributor III
Contributor III
Author

Great great great !!!☀️ 

As we say in french .. Bravo et merci 

@GaryGiles Thanks a lot..