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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
r_wroblewski
Partner - Creator III
Partner - Creator III

Field Trigger not working like expected

Hello Community

I created a field trigger which changed a field value(seperated table) according the selected period.

Action:   Select in Field

Field:     Period_Info

=if(Max(Date)=Max({1}Date) and Min(Date)=(Max({1}Date)-6), 'Last 7 days',

if(Max(Date)=Max({1}Date) and Min(Date)=(Max({1}Date)-29), 'Last 30 days',

if(Max(Date)=WeekEnd(Max({1}Date),-1) and Min(Date)=WeekStart(Max({1}Date),-1), 'Last Week',

if(Max(Date)=MonthEnd(Max({1}Date),-1) and Min(Date)=MonthStart(Max({1}Date),-1), 'Last Month',

'Individual'))))

For 'Last 7 days' & 'Last 30 days' the trigger works fine but for 'Last Week' & 'Last Month' the trigger select 'Individual'.

I checked the value in text boxes and they are correct and also tried with variables for 'Last Week'/'Last Month'. Same results.


Can someone advice me why the trigger is not working correctly ?


Best regards,


Ronny

1 Solution

Accepted Solutions
ramoncova06
Partner - Specialist III
Partner - Specialist III

Weekstart and monthstart are not rounded numbers

use a floor function before them

if(Max(Date)=floor(WeekEnd(Max({1}Date),-1)) and Min(Date)=floor(WeekStart(Max({1}Date),-1)), 'Last Week',

if(Max(Date)=floor(MonthEnd(Max({1}Date),-1)) and Min(Date)=floor(MonthStart(Max({1}Date),-1)), 'Last Month',

'Individual'))))

View solution in original post

2 Replies
ramoncova06
Partner - Specialist III
Partner - Specialist III

Weekstart and monthstart are not rounded numbers

use a floor function before them

if(Max(Date)=floor(WeekEnd(Max({1}Date),-1)) and Min(Date)=floor(WeekStart(Max({1}Date),-1)), 'Last Week',

if(Max(Date)=floor(MonthEnd(Max({1}Date),-1)) and Min(Date)=floor(MonthStart(Max({1}Date),-1)), 'Last Month',

'Individual'))))

r_wroblewski
Partner - Creator III
Partner - Creator III
Author

Dear Ramon,

Thanks for your advice.

It`s working fine now.

Regards

Ronny