Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
Hi
Try
=sum(if(recorddate=Chr(39)&GetFieldSelections(selecteddate, Chr(39)&','&Chr(39))&Chr(39), revenues))
Hi Andrey. Sorry, but expression does not not do thhe job. I'm not able to see revenues even for a single selection now.
Try this
=Sum({<recorddate = P(selecteddate)>} revenues)
did you try
=sum(if(recorddate=selecteddate, revenues))
or
sum({<recorddate=P(selecteddate)>} revenues)
even worse this way round..
Same as Sunny solution.
Please note that selected date and recorddate are not connected. That's why I was using the getfieldselections function.
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.
Hi Gabriel,
Can you please try
=sum({<recorddate={ $(=chr(39) & concat(distinct seelcteddate,chr(39)&chr(44)&chr(39)) & Chr(39)) } >} revenues)
Thanks.
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.