Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Attempting to create an active flag

Hi, I just started using Qlik Sense and I'm trying to create an active flag filter that can mark a post as either active or inactive depending on what dates it's is set to activate between.
I've attempted to do this by importing an excel file that contains todays date and I'm pulling the activation/deactivation dates from a database. I'm not very familiar with how the code in Qlik Sense works so I tried some VERY basic solutions to my problem, the main one being:

if (TodaysDate > VALIDFROM and TodaysDate < VALIDTO, FlagActive = 1)

I'm attempting to do this so that I can show only  active or inactive users.

Apologies for somewhat poor english, it isn't my main language.

Thank you in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You can create such a field in the data load script:


MyTable:

LOAD

     ...some fields...,

     if( VALIDFROM < today() AND VALIDTO > today(), 1, 0) as FlagActive,

     ...some more fields...

FROM ...mysource


Note that the VALIDFROM and VALIDTO fields need to be real  date fields. If those fields contain text values you'll have to use the date# function to turn the text values into strings. For example date#('31/12/2014', 'DD/MM/YYYY') will turn the string 31/12/2014 into a real date value.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

You can create such a field in the data load script:


MyTable:

LOAD

     ...some fields...,

     if( VALIDFROM < today() AND VALIDTO > today(), 1, 0) as FlagActive,

     ...some more fields...

FROM ...mysource


Note that the VALIDFROM and VALIDTO fields need to be real  date fields. If those fields contain text values you'll have to use the date# function to turn the text values into strings. For example date#('31/12/2014', 'DD/MM/YYYY') will turn the string 31/12/2014 into a real date value.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you for the help, was completely stumped on what to do