Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Chart Expression with date functions

Hello,

I have a table Shipping with columns ship_id, PartNum, ship_date etc. I am trying to create a chart .

The first dimension is PartNum, second is Month. For each month, I have to calculate this expression => 1/X and display this value in the chart

Where x is the count(ship_id) for ship_date within 12 months but starting from (month - 2).
For example, if month selected is July 2007, then start counting ship_id by going back two months i.e May 2007

For Jul 2007, need count(ship_id) for ship_date between Jun 2006 to May 2007
For Aug 2007, need count(ship_id) for ship_date between Jul 2006 to Jun 2007

How can I construct this expression? Please help.

3 Replies
Not applicable
Author

Hi,

please see the attached example. It should give you a hint to solve your problem.

Good luck!

Rainer

Not applicable
Author

Hi Rainer,

I was able to open your file the first time, couldn't open it later. Can you please attach the file again?
Also, after posting this question, I tried this.
Created a chart.
The first dimension is PartNum, second dimension is Month(ship_date)
Then defined this expression


if( Month(ship_date) < Month( AddMonths(ship_date, -2) ) OR
Month(ship_date) > Month( Addmonths(ship_date, -14) ), count(ship_id_) )

But not sure, if this is the correct expression.

Not applicable
Author

Hi,

here are the application again.

In your expression it seems to me that you have to change "or" in to "and".

Rainer