Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Set analysis and two dates Fields

Hi,

I've got in my module,

the following tables:

Item Table:

Item,

Date

Sales:

Item,

SaleDate,

Qty

I need to calculate for each item sum(Qty) where SaleDate<= Date.

I know set analysis back and forward but somehow i can't manage to do that.

Can someone know how to solve this issue?

Thnx a lot

1 Solution

Accepted Solutions
bbi_mba_76
Not applicable

Re: Set analysis and two dates Fields

Hi,

did you try using an if ?

sum(if( SaleDate<=Date,Qty))

14 Replies
Not applicable

Re: Set analysis and two dates Fields

sum({<SaleDate = {"<= Date"}>} Qty)

let me know if this works for you.

tresesco
Not applicable

Re: Set analysis and two dates Fields

sum({<SaleDate ={ "<= Date"}>} Qty)

Not applicable

Re: Set analysis and two dates Fields

See the set analysis used in the tables in the attached file.

bbi_mba_76
Not applicable

Re: Set analysis and two dates Fields

Hi,

did you try using an if ?

sum(if( SaleDate<=Date,Qty))

Not applicable

Re: Set analysis and two dates Fields

Great & Simple

Not applicable

Re: Set analysis and two dates Fields

While the solution works, if statements produce slower results than set analysis.

Not applicable

Re: Set analysis and two dates Fields

I dont know if im missing somethign here, but you dont need set analysis. You just need an if statement in the expr =sum(if(SalesDate<=Date,Qty)). Please check the attached.

Not applicable

Re: Set analysis and two dates Fields

Yes both solutions will work, but if statements produce slower results than using set analysis. It is optimal to use set analysis over if statements whenever possible

Not applicable

Re: Set analysis and two dates Fields

I know set analysis is quicker,

still didn't get right syntax for set analysis that works for that.