Forum Discussion
Possible Tip/Trick: Dynamic Date Dimension Table
BTW I always use today() not now()
Does it make any difference?
- ALeef10 years agoResolver II
TODAY() only returns a day, and sets the time to 12:00am. For this instance, I don't think it matters, but I use timestamps regularly, so that is what I'm in the habit of.
Good question!
- Anonymous10 years agoNot applicable
Hi,
I notice you refer to TODAY() and NOW() functions.
I am looking to include rolling periods in my date dimension, but I can't seem to get the TODAY() function to work in Power BI Desktop.
Using 'Add column' to test a generic 'Current Date' column - to use i.e. to calculate deal age or similar, I get this result.
Formula;
= Table.AddColumn(#"Changed Type6", "TESTTODAY", each TODAY())
Error Message;
"Expression error: The name 'TODAY' wasn't recognized. Make sure it's spelled correctly."
Would you happen to have any useful insights, how to apply this formula in Power BI?
Thanks.
- greggyb10 years agoResident Rockstar
TODAY() and NOW() are DAX functions and are available in the data model. You'd define a new column with a ribbon button called 'New Column'.
You are referring to the 'Add Custom Column' button in Power Query. Power Query uses the M data mashup language, which is based on the F# language. In M the way to get the current date-time is as follows:
// Power Query // Current date-time = DateTime.LocalNow() // Current date (without any time portion) = DateTime.Date( DateTime.LocalNow() )