Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
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

how to write it

I have too much raw data . I want to get a range's sales. I set the following range as a dimension:

if(date(sale_date)-date(prod_date)<=30,'sal_30',if(date(sale_date)-date(prod_date)<=70,'sal_70',if(date(sale_date)-date(prod_date)<=120,'sal_120','other')))---------    

I always get the error "allocation memory exceed."  . Is there another method to get the result  ?

Each  product have own's fixed date. The sale's date have many date .

7 Replies
joshabbott
Creator III
Creator III

I would write your if statement in the script instead of in the dimension, bring back a column name with 'Range Sales'.  This will also make your object quicker with refreshing changes.

Not applicable
Author

I have different end-date that depend on  user's selection . The range sales is different.

Anonymous
Not applicable
Author

Hi,

Write this into a variable

vcalc:

=date(sale_date)-date(prod_date)

and in the expression write this expr

=if(S(vcalc)<=30,'sal_30',S(vcalc)<=70,'sal_70',S(vcalc)<=120,'sal_120','other'))

So that calculation is done only once instead of thrice.

Not applicable
Author

=if($(vcalc)<=30,'sal_30',$(vcalc)<=<=70,'sal_70',$(vcalc)<=<=120,'sal_120','other'))--- can't work. what is S  meaning ?

the <=<= can't work .

Not applicable
Author

what is the error?

The S means $ I think its a typographical error?

Is date_prod a variable, or a selection from a data Island?

Not applicable
Author

what is the error?

The S means $ I think its a typographical error?

Is date_prod a variable, or a selection from a data Island?

Not applicable
Author

one  product has only one  prod_date:   20130105   b  20130203   c 20130407

but the sales date have many for every product .I want to get range sales like 30days,70days from prod_date untill user's selection monthes.