Using the NOW and TODAY functions
There are two functions to return the current datetime and date in the model. The TODAY
function will return the current date with the time set to 12:00:00 AM. This function is useful when you need to use the current date as an input for your time calculations. The NOW
function returns not only the current date, but also the exact time of when the function is executed. Depending on the time interval required, using the today function would allow you to calculate the number of sales over the last 6 or 12 hours.
How to do it...
Open the Model.bim to the Calc_Date_T table.
In the measure creation area, click on an empty cell to create a measure to return the current date and time:
Current_DateTime:=NOW()
Now that you can see the date and time, create a new measure under the Current_DateTime measure name Current_Date to return the current date with the time set to 12:00:00 AM:
=Current_Date:=TODAY()
How it works...
In this recipe, you...