Tuesday, 27 August 2013

DAX for DATEADD(DD, -1, GETDATE())

In DAX the equivalent of GETDATE() is NOW().


The DATEADD function varies depending on what time unit you are adding. To add or subtract days it couldn't be easier.


NOW() -1 takes a day from the current time. NOW() + 5 adds five days.


To add a month you use the EDATE function. So to add two months to the current date you use EDATE(NOW(), 2).


So to use DATEADD(DD, -1, GETDATE()) in a filter or calculate table you would do something like.


CALCULATETABLE('Contacts','Contacts'[CreatedOn] > now() -1 )



No comments:

Post a Comment