Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
eprehu
Contributor III
Contributor III

Multiple condition and sum

Bonjour, 

Comment puis je faire deux if. Sommer les deux conditions et faire : si cette  sum =2 => true sinon false

1ere condition :

=if(
[Store Channel] = 'Physical Store' or [Store Channel] = 'Outlet', 1,0
)

2em condition :

=if(
[Store Channel] = 'E-commerce', 1,0
)

eprehu_0-1652711721222.png

Je dois calculer un client qui a fait une transaction (le store channel) en physical store (ou en outlet) et sur du ecommerce 

Labels (1)
12 Replies
eprehu
Contributor III
Contributor III
Author

It doesn't work

vinieme12
Champion III
Champion III

Doesn't work as in 

  • Gives an error in expression?
  • Returns null?
  • Returns 0?

Can you post a screenshot of your data model?

And a screenshot of the chart you are trying it in and the expression you used

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
lukas_
Contributor III
Contributor III

Voici une piste à adapter au script bien sûr : 

 

//Récupération des clients dont Store Channel vaut 'Physical Store' ou 'Outlet'
TMP_1_CUSTOMERS_FILTRE:
load distinct
	[Customer Key],
    1    								as flag
resident your_table
where WildMatch([Store Channel], 'Physical Store', 'Outlet');

//Récupération des clients dont Store Channel vaut'E-commerce'

Concatenate (TMP_1_CUSTOMERS_FILTRE)
load
	[Customer Key],
    1    								as flag  
resident your_table
where WildMatch([Store Channel],'E-commerce');


left join (your_table)		//On ramène le flag à la table principale
load 
	[Customer Key],
    if(flag >= 2, 'true', 'false')		as [Customer Flag]
;
load 
	[Customer Key],
    sum(flag)							as flag
resident TMP_1_CUSTOMERS_FILTRE
group by [Customer Key];

drop table TMP_1_CUSTOMERS_FILTRE;