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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Champion
Champion

Hi,

try this:

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

View solution in original post

13 Replies
YoussefBelloum
Champion
Champion

Hi,

try this:

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

Anonymous
Not applicable
Author

thanks a lot

YoussefBelloum
Champion
Champion

you're welcome

good luck

Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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
Champion
Champion

Yes because it is static inside the expression.

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

Anonymous
Not applicable
Author

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
Champion
Champion

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

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