Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Partner - Specialist
Partner - Specialist

Hi,

did you try using an if ?

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

View solution in original post

14 Replies
Not applicable
Author

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

let me know if this works for you.

tresesco
MVP
MVP

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

Not applicable
Author

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

bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi,

did you try using an if ?

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

Not applicable
Author

Great & Simple

Not applicable
Author

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

Not applicable
Author

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
Author

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
Author

I know set analysis is quicker,

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