Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Refering to a field , and manipulating that field in set analysis

Hello,

I have two time fields, and want to use set analysis to set time1 >= (time2 minus 3 months). Is this possible? I have attempted this and have not had any luck. My attempt is below.

=count({$<Time1={"=Time1>=AddMonths(Time2,-3)"}>} Distinct OrderID)

Any help would be appreciated.

Thanks Much!

3 Replies
Not applicable
Author

Hello,

try

=count({<Time1>=$(=AddMonths(...))>} distinct OrderID)

The trick is, to embrace the expression in $(). This makes QV to evaluate the expression.

hth,
Thilo

Not applicable
Author

Sorry ... too quick reply ... I checked my own code now ... I use it like this:

SUM( {<DateDMY={'>=$(=AddMonths(monthstart(max(DateDMY)),PeriodMonths)) <=$(=monthend(max(DateDMY)))'} >} Value)



Not applicable
Author

First, thanks for the response.

However It seems that you only refer to one time field (DateDMY) in your expression.

I actually want to evaluate where DateDMY >= Date2DMY-3 months. So I have two separate date fields in total in the expression. Hopefully this makes sense

Regards.