Forum Discussion
M Query to pull only prior month data from HANA
- Anonymous3 years ago
This is what worked for me:
WHERE
(
(
"PrimaryApproval" > Add_Months(Last_Day(current_date), -2)
AND "PrimaryApproval" <= Add_Months(Last_Day(current_date), -1)
)
OR (
(
"FinalApproval" > Add_Months(Last_Day(current_date), -2)
AND "FinalApproval" <= Add_Months(Last_Day(current_date), -1)
)
AND "PrimaryApproval" = '00000000'
)
)
A little more information:
We are using the _SYS_BIC schema. I would expect the statement below to get the previous month, but again, the 'DateTime' is an issue.
Date.IsInPreviousMonth(Date.AddMonths(DateTime.FixedLocalNow(), -1))