Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Not applicable

Expression problem


Hello:

I have two sliders linked to 2 variables (vCapacity80, vCapacity80Unit) and the sliders are working fine for a line on a line chart.

My chart dimension is a date.

The problem is that I also want to incorporate two date "sliders/calendars" so when a user selects a date range the sliders mentioned above will only change the part of the line between the user selected dates. My date variables are vCapDateMax and vCapDateMin. Currently if dates are entered there is no change to the line chart.. doesn't move.

Here is my test expression that's not working:

//vCapDateMin and vCapDateMax is '' when empty,

//check to see if dates have been entered

if(len(vCapDateMin)=2 or len(vCapDateMax)=2,

sum(Capacity80) + (sum(Capacity80) * vCapacity80) + vCapacity80Unit

,

//dates entered therefore have the slider increase/decrease only happen for the dates in between

// TESTING keep it simple for now and only effect the line where the date > vCapDateMax, once working change

// it to use  >= vCapDateMin and <= vCapDateMax

sum(Capacity80) + (sum({$ <ReferenceDate={'>$(vCapDateMax)'}>}Capacity80) * vCapacity80) + vCapacity80Unit)

I've attached a picture of the chart... it's the red line that uses the working sliders but I can't get the line working when I incoporate the dates

Thanks!

3 Replies
MVP
MVP

Re: Expression problem

It's quite hard to tell what my be wrong with just looking at the image and your expression. Could you post a small sample app that demonstrates your issue?

I have also problems understanding the logic you want to apply, but that's probably the case because I don't know your requirements.

If you suspect the sum() with the set analysis to not working as intendend, I would suggest that you isolate the expression (e.g. in a text box):

=sum({$ <ReferenceDate={'>$(vCapDateMax)'}>} Capacity80)

You need to check if the dollar sign expansion of vCapDateMax returns something meaningful, and then if this matches the format of ReferenceDate values.

Not applicable

Re: Re: Expression problem

Thanks swuehl! I've posted a sample of what I'm trying to do... I would expect if dates are entered the charts red line will only change in between the dates using the sliders which change the values.

MVP
MVP

Re: Re: Re: Expression problem

Try these as part of your expression:

sum(Capacity80) + (sum({$ <ReferenceDate={'>$(=Date(vCapDateMin))<$(=Date(vCapDateMax))'}>}Capacity80) * vCapacity80) + vCapacity80Unit

the additional date() functions take care of value formatting for the set modifier.