Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Meshaikh1995
Contributor II
Contributor II

Need to find date based on expression

hi.

i need to create an filter, like if user enter 01-01-2022 to 02-02-2022, so all sales between this date should be show.

or someone plz talk me what expression i need to wright to get sale between. i.e.  02-02-2022 to 03-05-2022. 

Labels (5)
3 Replies
vinieme12
Champion III
Champion III

As below

 

=Sum({<Datefield={">=$(=Date(Min(Datefield)))<=$(=Date(Max(Datefield)))"}>}Sales)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
edwin
Master II
Master II

one option is to create a filter where you allow the user to select all the date fields by dragging the mouse across the date filter.  that is your simplest option and you dont need to add anything to your filter.

if on the other hand you want the user to type the date range, you need to make sure that the user follows a predefined format.  to answer your question directly, you can then parse the entered date range.  use subfield to get the first and second dates - you can parse the date range using space.  save the 1st and 2nd dates into two variables and use those variables in your set analysis:

sum({<[your date field]={">=$(vDate1)<={vDate2}"}>}metricField)

you need to make sure the date formats are consistent.

the issue with this is that you need to build logic to anticipate different styles of entering the date range, what errors are anticipated. 

look at this function:

https://help.qlik.com/en-US/sense/May2022/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions...

 

Meshaikh1995
Contributor II
Contributor II
Author

I create Day Month Year fields and use in variable, and use this set expression but filter pane not accepting.

sir i wanna create an filter pane, and in that filter if user type in search like i.e 01-02-2022 to 20-03-2022 so it should show all sales or data between this date, if is possible so plz talk me how can i achieve. 

This is My VaribleThis is My VaribleThis is my set expressionThis is my set expression