Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

IF AGGR COUNT

Hello, I would like to have the turnover of customers having 2 orders over a period.


But my formula does not work.

My order count is good


Nb of order : count( DISTINCT{<[Date Commande]={">=$(=vDateDébutAnnéeN) <=$(=vDateFinSeg)"}>} [N° Cde])


but not formula  :


Turnerover for 2 orders= If(   Aggr(count( DISTINCT{<[Date Commande]={">=$(=vDateDébutAnnéeN) <=$(=vDateFinSeg)"}>} [N° Cde]), [Code Client])=2

,[Ca Produit HT])


Capture.JPG

I need to aggr because in the end i need only one figure that will be the sum of all these clients



thanks for your help





1 Solution

Accepted Solutions
sunny_talwar

May be this

Sum({<[Code Client] = {"=Count(DISTINCT {<[Date Commande]={"">=$(=vDateDébutAnnéeN) <=$(=vDateFinSeg)""}>} [N° Cde]) = 2"}>} [Ca Produit HT])

View solution in original post

26 Replies
ali_hijazi
Partner - Master II
Partner - Master II

sum(aggr(count(distinct.....),[code client]))

I can walk on water when it freezes
sunny_talwar

Are you using this as your calculated dimension or is this an expression?

Turnerover for 2 orders = If(  Aggr(count( DISTINCT{<[Date Commande]={">=$(=vDateDébutAnnéeN) <=$(=vDateFinSeg)"}>} [N° Cde]), [Code Client]) = 2, [Ca Produit HT])

YoussefBelloum
Champion
Champion

If(   sum(Aggr(count( DISTINCT{<[Date Commande]={">=$(=vDateDébutAnnéeN) <=$(=vDateFinSeg)"}>} [N° Cde]), [Code Client]))=2

,sum([Ca Produit HT]))

Anonymous
Not applicable
Author

this is an expression

thanks

Anonymous
Not applicable
Author

thanks but how to get afterwards only the sum of all this in a single expression?

stabben23
Partner - Master
Partner - Master

then you need to "wrap" a sum around the Expression.

sum(If(   sum(Aggr(count( DISTINCT{<[Date Commande]={">=$(=vDateDébutAnnéeN) <=$(=vDateFinSeg)"}>} [N° Cde]), [Code Client]))=2

,([Ca Produit HT])))

Anonymous
Not applicable
Author

sorry it doesn't work

YoussefBelloum
Champion
Champion

here it is a single expression which will give the result you want, did you try it ?

sunny_talwar

May be this

Sum({<[Code Client] = {"=Count(DISTINCT {<[Date Commande]={"">=$(=vDateDébutAnnéeN) <=$(=vDateFinSeg)""}>} [N° Cde]) = 2"}>} [Ca Produit HT])