Hi all,
I am experiencing the same issue as @Anthony_Dob . I have a custom table in Dataverse and a Canvas App which is attempting to CountRows on the table. This is based in a Sandbox environment.
I saw this on the Power Apps Ideas pages which seems to indicate this is known behaviour, but it's very confusing. See also: CountRows function returning zero for DataVerse tables - Power Apps Canvas apps - Debajit's Power Apps & Dynamics 365 Blog (debajmecrm.com). I have now worked around this by using the steps shown above;
CountIf (<Data Source>, true>)
However, I am now finding I have the same problem (of "out of date" data) again when trying to use 'Last' on the table. I want to get the value from a new record I have just patched to the table, but using Last is currently returning 'out of date' data from a previous record on the table - even if waiting 30 - 120 seconds after the previous record was created.
Update: to hopefully make this easier to explain I've attached two screenshots. The first shows a Dataverse table that has records up to reference 'IO-09'. The second shows a very simple button in a Canvas App with OnSelect attempting to get the Last record in that table. Why is it returning an incorrect (out of date) value? It has been about 45 minutes since the two additional records, 08 and 09, were created, so it's not a lag issue.
Updates (2):
1. I went to the Data pane in the Canvas App studio and 'refreshed' the Dataverse table connection, it made no difference.
2. I tried Refresh (Table Name) in the OnSelect on the button (per my diagram); no difference.
3. I tried setting the variable to Blank () before setting it with the 'Last' value (just to ensure the variable was truly blank/empty), no difference.
4. I went to the table in Dataverse and added a new row directly in the table (as opposed to adding the rows by Patching from the Canvas App), again, no difference.
Have to say this is a waste of time and I thought Dataverse was supposed to make things easier/quicker/more reliable than using SharePoint lists, etc - so any help appreciated! Many thanks!