
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Qlik Sense Find a date in a date range with function
Hello,
I need help comparing a date with a range of dates with a funtion, for example:
Date_A = March-2022
Range_Date = February-2022 March-2022 April-2022
If it matches it should show a value and if not another.
Could you help me please?
Thank you and regards,
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
please post some sample data
temp:
Load *,SubStringCount(RangeDate,DateA) , index(RangeDate,DateA) Inline [
RangeDate,DateA
February-2022 March-2022 April-2022,March-2022
];
output
If a post helps to resolve your issue, please accept it as a Solution.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you could either use SubStringCount() or Index() for this
if( SubstringCount('March-2022','February-2022 March-2022 April-2022') , then ,else)
or
if(Index('February-2022 March-2022 April-2022','March-2022'), then, else)
If a post helps to resolve your issue, please accept it as a Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This it doesn't work for me... I think the problem is that the data is in variables, Date A is a 1 variable and Range_Date is another variable, they are not manual strings.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This Works though!; please post your actual script
let DateA = 'March-2022';
let RangeDate = 'February-2022 March-2022 April-2022';
let substrA= SubStringCount('$(RangeDate)','$(DateA)');
let indexA= index('$(RangeDate)','$(DateA)');
substrA is set to 1; <--occurences
indexA is set to 15 ;<--position in string
If a post helps to resolve your issue, please accept it as a Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Surely I have a mistake...I'm new to this...
for example: SubStringCount([#RANGE_DATE],[#DATE_A]) it's fields not variables sorry


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
please post some sample data
temp:
Load *,SubStringCount(RangeDate,DateA) , index(RangeDate,DateA) Inline [
RangeDate,DateA
February-2022 March-2022 April-2022,March-2022
];
output
If a post helps to resolve your issue, please accept it as a Solution.
