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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
HMUTUAL01
Contributor III
Contributor III

Date Picker Selection

I am using the date picker in the following query to pick the date in a table. The table only has business dates so I would to modify the selection to pick the next previous date which is available. For example, if the user selects 1/1/24 it would look back and see the closest date prior to 1/1/24 is 12/29/23 and would return that value. Is there a way to implement this?

 

Sum({<[DS_POST_DT]={"$(=Min(REPORT_DATE_KEY))"}>} DS_Prior_BALANCE)

Labels (5)
8 Replies
Anil_Babu_Samineni

@HMUTUAL01 If you want prior date from selection, You can try this.

Sum({<[DS_POST_DT]={"$(=Date(Max(DS_POST_DT)-1)"}>} DS_Prior_BALANCE)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jochem_zw
Employee
Employee

See Anil post, this should work, when date  format is ok 

HMUTUAL01
Contributor III
Contributor III
Author

@Anil_Babu_Samineni I tried this but nothing was returned. Jochem mentioned "when Date format is ok" so I am not sure if that if that is the issue. The first column is the original without the code and the second is the one where I applied the logic provided. 

 

 

HMUTUAL01_0-1707073546945.png

 

vinieme12
Champion III
Champion III

just specify the date format to match the date format of your field as below

 

Sum({<[DS_POST_DT]={"$(=Date(Max(DS_POST_DT)-1,'YYYY-MM-DD')"}>} DS_Prior_BALANCE)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
HMUTUAL01
Contributor III
Contributor III
Author

Below is the error message I receive when I use the logic above. Any ideas why I am getting this error message?

HMUTUAL01_2-1707140293215.png

 

HMUTUAL01_1-1707140268125.png

 

 

HMUTUAL01
Contributor III
Contributor III
Author

How do I set the date picker to only allow the user to pick a date if it exist in the dataset? 

Anil_Babu_Samineni

@HMUTUAL01 Please share some sample data set and desired result you need. 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jochem_zw
Employee
Employee

Try this: Sum({<[DS_POST_DT]={"$(=Date((Max(DS_POST_DT)-1),'YYYY-MM-DD')"}>} DS_Prior_BALANCE)