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