Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

How can I sum all records by a specific date entered by the user filter

Good morning everyone, all right?
As stated in the subject, I need to sum all records until a specific date. I found a way to do this at this link.

https://community.qlik.com/t5/QlikView-Creating-Analytics/How-can-i-sum-all-records-until-a-specific...

But there is a detail, the date cannot be predefined, it needs to be informed by the user through the filter.
When the date is entered, it must be used as the maximum date; otherwise, The most recent date must be taken into consideration. How to proceed?
Thank you very much in advance.

1 Solution

Accepted Solutions
Highlighted
Luminary
Luminary

I think you are misunderstanding the solution you linked. This solution is dynamic to what date the user selects, there is no predefined date value.

 

In this formula: 

 

sum({$<Date= {"<=$(=max(Date))"}>} Amount)

 

 Date is a field. 

That means the max date value possible in the field Date will be the limit. 

Say you have these date values:

Date
01/01/2019
01/09/2019
01/17/2019
01/31/2019
 02/01/2019

 

With no selections the above expression will evaluate to:

 

sum({$<Date= {"<=02/01/2019"}>} Amount)

 

This would sum values 01/01/2019 - 02/02/2019

 

If a user selects '01/31/2019' in the filter, the expression would then evaluate to:

 

sum({$<Date= {"<=01/31/2019"}>} Amount)

 

This would sum values 01/01/2019 - 01/31/2019

 

Blog: WhereClause   Twitter: @treysmithdev

View solution in original post

2 Replies
Highlighted
Luminary
Luminary

I think you are misunderstanding the solution you linked. This solution is dynamic to what date the user selects, there is no predefined date value.

 

In this formula: 

 

sum({$<Date= {"<=$(=max(Date))"}>} Amount)

 

 Date is a field. 

That means the max date value possible in the field Date will be the limit. 

Say you have these date values:

Date
01/01/2019
01/09/2019
01/17/2019
01/31/2019
 02/01/2019

 

With no selections the above expression will evaluate to:

 

sum({$<Date= {"<=02/01/2019"}>} Amount)

 

This would sum values 01/01/2019 - 02/02/2019

 

If a user selects '01/31/2019' in the filter, the expression would then evaluate to:

 

sum({$<Date= {"<=01/31/2019"}>} Amount)

 

This would sum values 01/01/2019 - 01/31/2019

 

Blog: WhereClause   Twitter: @treysmithdev

View solution in original post

Highlighted
Contributor
Contributor

Thank you very much, I really got it wrong when I implemented that it wasn't working. Now yes, thank you very much;