Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I'm just trying to find the minimum payment date for the user id in the row.
But min() doesn't work with the date and I'm not sure it works correctly at all. For some rows it shows an empty value, and for some user ids it shows a different minimum date in each row. What can I do to make it work?
I try:
date(min(date#(payment_date, 'DD.MM.YYYY')), 'DD.MM.YYYY') as min_pmntD
min(payment_date)
etc.
Different options don't work.
Date format: DD.MM.YYYY
Do you have a "Group By" in your Load statement?
Hello! Yes, my script is:
left join (final_table)
load
user_id,
min(payment_date) as min_pmntD,
amount_money
Resident pmnts
group by
user_id,
amount_money;
_____________
I separately tried to reach this through the chart formula, counting the sum for the minimum date, but this still displays random values, and not those that really correspond to the minimum date
Sum({<[payment_date]= {"$(=(Min(total <user_id> payment_date)))"}>} amount_money)
Your script example looks perfectly OK, so there is something else that goes wrong.
It should also be possible in a chart formula (if the date has been correctly interpreted in the script). Your chart expression looks OK - but the "... total <user_id> ..." will be ignored: Dollar expansions and set expressions are not sensitive to chart positions. They are both evaluated globally, before the chart is broken down on individual rows.
Thank you for your help! I couldn't figure out what the problem was, so I went and changed the original sql query to my database, adding a min() there.