Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
VaishnaviMogal2
Contributor III
Contributor III

use variables to filter data

Hi,

I want to show dates between start date and end date. I'm using variables to store start date and end date as,

VStartDate = ONLY({<charge_session= {"$(=GetFieldSelections(charge_session))"}>} expected_start_time)

VEndDate = ONLY({<charge_session= {"$(=GetFieldSelections(charge_session))"}>} expected_end_time)

it is giving values correctly when I'm printing with $(VStartDate).  but when I am using these variables in 

if(DateTime >= $(VStartDate) and DateTime <= $(VEndDate),DateTime)  it is giving - . what is wrong in this statement?  How can I show data between start date and end date. 

Any suggestion would be helpful.

Thanks.

4 Replies
TauseefKhan
Creator III
Creator III

Hi @VaishnaviMogal2,

It seems that the issue might be related to the format of the dates.

LET VStartDate = ONLY({<charge_session= {"$(=GetFieldSelections(charge_session))"}>} expected_start_time);
LET VEndDate = ONLY({<charge_session= {"$(=GetFieldSelections(charge_session))"}>} expected_end_time);

if(
DateTime >= Date#($(VStartDate), 'YourDateFormat')
and DateTime <= Date#($(VEndDate), 'YourDateFormat'),
DateTime
)

Replace 'YourDateFormat' with the actual format of your dates, such as 'MM/DD/YYYY' or 'YYYY-MM-DD'.

VaishnaviMogal2
Contributor III
Contributor III
Author

Hi, @TauseefKhan 

Date Format is same for both fields i.e., 'M/D/YYYY H:mm:ss TT'

VaishnaviMogal2_1-1719226939013.png

 

 

HirisH_V7
Master
Master

Hi Check this.

https://community.qlik.com/t5/QlikView-App-Dev/From-Date-and-To-Date/td-p/1787544

HirisH
“Aspire to Inspire before we Expire!”
VaishnaviMogal2
Contributor III
Contributor III
Author

Still the issue is not resolved. 😢