Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joeychua
Contributor
Contributor

If Statement in Data range

I am trying to create an IF statement to call out the data from a date range, for 3 months, 2 months, and 1 month, for a specific type of product.

=MaxString(
{<[Date]={if(">=$(=Date(AddMonths(LasRefresh,-3)) <=$(=Date(AddMonths(LasRefresh,-2)))",'3 Months'

,if(">=$(=Date(AddMonths(LasRefresh,-2)) <=$(=Date(AddMonths(LasRefresh,-1)))",'2 Months')

,if(">=$(=Date(AddMonths(LasRefresh,-1)) <=$(=Date(AddMonths(LasRefresh,-1)))",'1 Month')}
,[Product Type]={'Sale'}
>} [Date] )

 

Labels (1)
3 Replies
miskinmaz
Creator III
Creator III

Why don't you just try to add the conditional statement at back end and create one extra field though script.

joeychua
Contributor
Contributor
Author

How and what should I add to my expression/script in order to make what i want to display?

Brett_Bleess
Former Employee
Former Employee

Joey, check the following Design Blog Link and note there are some other links at the bottom of that post as well:

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

Hopefully this will help you get things sorted out and feel free to back the URL up to the Qlik-Design-Blog/ level and use the search dialog there to dig further if you wish.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.