Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
saumyashah90
Specialist
Specialist

How to change data according to start and enddate?

I created variables named StartDate and EndDate

Then in slider/calendar object i selected =Min(Date) as minvalue and =Max(Date) as maxvalue

start date.JPG

similarly for variable EndDate i choosed =$(StartDate) as minvalue and -Max(Date) as max value

enddate.JPG

then in a barchart in expression i wrote

=Sum(if( Date>=$(StartDate AND Date <=$(EndDate),Field1))

But chart is not responding accordingly

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You'll want to use max({1} Date) and min({1} Date) instead of max(Date) and min(Date). The {1} will make sure the min and max dates you can select are not influenced by earlier selections. And you need to use triggers so that the selection in your Date field changes if you change the dates in your calendar objects. See this tutorial for a complete explanation.

Your sum expression can be rewritten as sum({<Date={'>=$(StartDate)<=$(EndDate) '}>} Field1). But only if you don't use Date as a dimension in your bar chart. Otherwise use your expression.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Not applicable

on second calendar:

minvalue :

=date($(StartDate))

maxvalue:

=Max(1{}Date)

sushil353
Master II
Master II

use

=Min({}Date)

=Max({}Date)

then in expression use

=Sum(if( Date>=$(StartDate) AND Date <=$(EndDate),Field1))

Not applicable

see att qvw file

Gysbert_Wassenaar

You'll want to use max({1} Date) and min({1} Date) instead of max(Date) and min(Date). The {1} will make sure the min and max dates you can select are not influenced by earlier selections. And you need to use triggers so that the selection in your Date field changes if you change the dates in your calendar objects. See this tutorial for a complete explanation.

Your sum expression can be rewritten as sum({<Date={'>=$(StartDate)<=$(EndDate) '}>} Field1). But only if you don't use Date as a dimension in your bar chart. Otherwise use your expression.


talk is cheap, supply exceeds demand
Not applicable

Could you please try below expression?

=Sum(if( Date>=$(StartDate) AND Date <=$(EndDate),Field1))