DMF TransferStatus to check entity processing

When we work with a Data Entity in D365FO, it can get tricky to track how transfers are going and how much is left. Here is a quick SQL snippet to query staging tables to figure out DMF TransferStatus:

select
  executionid,
  transferstatus,
  case
    when transferstatus = 0 then 'Not started'
    when transferstatus = 1 then 'Completed'
    when transferstatus = 2 then 'Error'
    when transferstatus = 3 then 'Validated'
    when transferstatus = 4 then 'Duplicate'
  end AS StatusTxt,
  count(*) from [dbo].[CUSTCUSTOMERV3STAGING]
group by executionid, transferstatus

This snippet can tell us how many records have been completed, has an error, or still remaining to be processed. It only works if a staging table is being used for the data entity export/import.