Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Don't miss the upcoming Q&A with Qlik session on Qlik Application Automation on November 16th! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

getfieldselections with multiple values

Hi everyone.

I'm currently trying to use the function getfield slections in order to filter a table based on a selected value in a filter box.

The expression I'm currently using is the following:

=sum(if(recorddate=getfieldselections(selecteddate), revenues))

The problem arises when I select two or more date in the filter box: the if function finds no corresponding value.

How can I deal with this issue? Thanks.

Please see attachments for further details.

Additional info: selectedddate and recorddate are not linked together - there's no association between them.

1 Solution

Accepted Solutions
sunny_talwar

It doesn't matter if they are from two different sources. Have you checked if both the fields are read as dates by QlikView? This isn't going to work if one is text and other is date.

View solution in original post

10 Replies
ahaahaaha
Partner
Partner

Hi

Try

=sum(if(recorddate=Chr(39)&GetFieldSelections(selecteddate, Chr(39)&','&Chr(39))&Chr(39), revenues))

Not applicable
Author

Hi Andrey. Sorry, but expression does not not do thhe job. I'm not able to see revenues even for a single selection now.

sunny_talwar

Try this

=Sum({<recorddate = P(selecteddate)>} revenues)

mov
Champion III
Champion III

did you try

=sum(if(recorddate=selecteddate, revenues))

or

sum({<recorddate=P(selecteddate)>} revenues)

Not applicable
Author

even worse this way round..

Cattura.PNG

Not applicable
Author

Same as Sunny solution.

Please note that selected date and recorddate are not connected. That's why I was using the getfieldselections function.

sunny_talwar

It doesn't matter if they are from two different sources. Have you checked if both the fields are read as dates by QlikView? This isn't going to work if one is text and other is date.

View solution in original post

kvanandan1
Creator
Creator

Hi Gabriel,

Can you please try

=sum({<recorddate={ $(=chr(39) & concat(distinct  seelcteddate,chr(39)&chr(44)&chr(39)) & Chr(39)) } >} revenues)


Thanks.

mov
Champion III
Champion III

Both my expressions are exactly for the situation when the two dates are not associated.
The most likely reason it doesn't work, as stalwar1‌ mentioned, that the fields are not in the same format.  On your screenshot, the MonthYear field is left-aligned, as text aligned by default.  Whatever expression you choose, make sure that the format is the same.  You can do it within the expressions, but it makes more sense to fix it on the script level.