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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Writing If expresion

I'm displaying data on chart by writing a simple expression - Avg(Population)

What should be the expression if I want to show data corresponding to following condition:

if(date<X)

     Avg(Population)

That is, Avg(Population) should be calculated and shown for the dates less than X

Labels (1)
5 Replies
anbu1984
Master III
Master III

if(date<Date#('1/1/2014','MM/DD/YYYY'),Avg(Population))

sujeetsingh
Master III
Master III

Avg(if(date<X,Population))

You can go for set analysis

Avg({$<Date<X>}Population)

Not applicable
Author

By mistake I could not ask what I actually meant. I want a conditional expression for showing Avg(Population) for dates less than X.

For example, if I have population value at 3 different dates (W, X, Z), I would like to show Avg(Population) for all the dates less than X. Average value should not include population value at Z.

anbu1984
Master III
Master III

If you have only one expression, then try any of the above suggested solutions and select "Suppress zero values" on Presentation tab

Not applicable
Author

let vDate=date(max(date))

avg({<date={"<=$(vDate)"}>}population)

cheers,

kunal bhattacharjee