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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
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

 

 

VaishnaviMogal2
Contributor III
Contributor III
Author

Still the issue is not resolved. 😢