Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I need help coding a button that uses a selected field (that always has one selected value no matter what).
So basically I have a date that is selected and I need to create a button that compares another field called start date (also date format) to it. The button should show all the data for which the following statement is true: batchdate2 >= startdate.
After clicking the button, the various dates that are less than or equal to the batchdate2 selected value should become a selection so the other data that's greater than the batchdate2 value will go away (and not affect calculations).
Foe example, the data for the dates 2022-07-05 and 2023-01-03 should not be in the table once I click this button. Any ideas on how to do this? I keep wondering if there are any functions like select or createSelection(batchdate2 >= startdate). Please help if you can; I've been at this for hours, but I just don't know what to use...and also the syntax is a little confusing lol!
Hello,
Check this video, I believe it can help you solve it.
https://www.youtube.com/watch?v=RS7pbzPGW1I
If it doesn't, share a sample of the data if possible and we can try to work it out.
Regards
Hello,
Thanks so much for the video! Didn't know about the Aggr function before so it helped me learn that.
But I'm not sure if it will help me because it's a chart function and the user should be able to check the condition batchdate2 >= startdate at any time.
Since I'm applying this to a button, do you think the aggr function would still work? And would I select the action "Select values in a field" and then put the condition statement/expressions inside the "Value" box? (just want to make sure)
I didn't create a temporary table with a duplicate field since I already have the startdate field to compare to the batchdate field. Also, if you explain how Qlik will actually select the range of dates, maybe that will be helpful to understand.
What more of the sample data do you need to understand the problem?
Thanks again!
Try adding a button with this expression:
Aggr(
Only({<StartDate={">=$(=batchdate2)"}>} StartDate),
StartDate)
In short, it is a virtual table that will list the StartDates greater than the value selected in batchdate2
Hi,
Is this correct?
because when I click on the button, nothing happens? Do I need to drag in a table from the list of charts?
The button will filter values in a list, so you need to pass them like --> Value1,Value2,Value3 ..
For that, just add the concat function:
Concat ( distinct Aggr(
Only({<StartDate={">=$(=batchdate2)"}>} StartDate),
StartDate) , ',')