Need to check the last time when our ETL processes ran successfully
Data warehouse developers routinely query the last data date (the last date when we have fact data) to check the last time when our ETL processes ran successfully.
It’s not hard to do it in TSQL. It just requirements a bit of typing. In this example, I am showing the last data date in its readable format and the Sales Amount on that day.
A lot easier to do this in MDX
It’s actually a lot easier to do this in MDX. With the help of the TAIL() function and the NONEMPTY() function, the last data date is easy to query without any sub-queries or calculations.
Always verify
To make sure we got it right, run this simple query to verify.
Note: There is no need to order by the Date dimension. It’s already ordered in the SSAS.