Hi all!
I have what I am sure is a very quick and easy question!
I have a SQL table with a list of visits to customers.
What I need to do is pull back the last record for that customer and then show the date column
For example:
custname | custid | date |
Comp1 | 1 | 20/02/2020 |
Comp1 | 1 | 20/03/2020 |
Comp2 | 2 | 19/01/2020 |
Comp2 | 2 | 27/02/2020 |
Comp3 | 3 | 30/03/2020 |
So for instance I want to do a Lookup for custid = 2 and Return the last entered date column.
This would return 27/02/2020, is this possible.
The only way I have made this happen so far is with the following code:
ClearCollect(
LastVisit,
LastN(
Filter(
'[dbo].[visitlog]',
custid = Text(ThisItem.ID)
),
1
).date
Obviously this then adds it to a collection, I can then return that collection into a Drop down and Then that drop down into a Label Field.
This just seems a long winded way to get what I need.
Any help is much appreciated!
Cheers,
Danny
New it would be something simple!!!
Thanks for the tip on the column name! Will change this as well.
Hi @MrDannyHarry ,
I am a SharePoint user, but this may work (it does on my large test list).
Also, date is not a good title for a field - it is a reserved word.
First(
Sort(
Filter(
'[dbo].[visitlog]',
custid = Text(ThisItem.ID)
),
date,
Descending
)
).date
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2