Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

gsteimer
New Contributor II

AVG if

Hi all,

My table is like that and

I want to calculate the average of Tx de marge but I Don't want to take the value if date fin contrat <31/08/2018 and if Matricule facturation = INTERNE

Capture qlik 3.JPG

1 Solution

Accepted Solutions
YoussefBelloum
Esteemed Contributor

Re: AVG if

Hi,

try this:

Avg({<[date fin contrat]={">31/08/2018"},[Matricule facturation]-={'INTERNE'}>}Marge)

13 Replies
YoussefBelloum
Esteemed Contributor

Re: AVG if

Hi,

try this:

Avg({<[date fin contrat]={">31/08/2018"},[Matricule facturation]-={'INTERNE'}>}Marge)

gsteimer
New Contributor II

Re: AVG if

thanks a lot

YoussefBelloum
Esteemed Contributor

Re: AVG if

you're welcome

good luck

gsteimer
New Contributor II

Re: AVG if

after changement of date, it doesn't work

I think that it's because the formula exclude the empty value in date fin de contrat.

gsteimer
New Contributor II

Re: AVG if

after changement of date, it doesn't work

I think that it's because the formula exclude the value of marge when in date fin de contrat the value is empty

gsteimer
New Contributor II

Re: AVG if

I try this formula without success

Avg({<[Début de contrat]={"<=31/08/2018"},[Date fin de contrat]-={"<31/08/2018"},[Matricule facturation]-={'INTERNE'}>}Marge)

YoussefBelloum
Esteemed Contributor

Re: AVG if

Yes because it is static inside the expression.

you can make it dynamic but how you will select a different date ?

gsteimer
New Contributor II

Re: AVG if

how can make it dynamic ?

I create a variable = 31/08/2018

and when I want to change the date, i Change the value of the variable

YoussefBelloum
Esteemed Contributor

Re: AVG if

you need to put your variable inside the expression, like this:

Avg({<[date fin contrat]={">$(your_variable_name)"},[Matricule facturation]-={'INTERNE'}>}Marge)