Forum Discussion
calendar with today function
- Anonymous9 years ago
TODAY() returns a date already. You don't need to nest it in a DATE() function. The formula should be
DateTable = CALENDAR( DATE(2015; 6; 1); TODAY() )
I recommend naming your calendar table "DateTable" instead of "Calendar". The word Calendar is reserved for the function named CALENDAR(), so every time you refer to that table you would have to put its name in single quotes. I find typing extra quotes around my table names annoying and try to avoid it wherever possible.
So you would be able to type
Measure = CALCULATE( [MeasureName], DATESYTD(DateTable[Date]))
instead of
Measure = CALCULATE( [MeasureName], DATESYTD('Calendar'[Date]))because
Measure = CALCULATE( [MeasureName], DATESYTD(Calendar[Date]))
would return an error.
- Anonymous9 years ago
The purpose of the DATE() function is to construct dates from components. It requires 3 separate arguments: a year, a month, and a day, each in the form of a whole number, and from that it returns a single item as its output: a full date. TODAY() takes no arguments, and also returns a single item: a full date. So TODAY() when nested in another function only constitutes one argument, not three, and also it doesn't fit the requirements of any of the three arguments needed for DATE(). It isn't a year, it isn't a month, and it isn't a day. It's a full date.
i'm trying to create a calendar to the first date of my database to the actual day to be able use it as database for filters like "sales from the two last weeks"
TODAY() returns a date already. You don't need to nest it in a DATE() function. The formula should be
DateTable = CALENDAR( DATE(2015; 6; 1); TODAY() )
I recommend naming your calendar table "DateTable" instead of "Calendar". The word Calendar is reserved for the function named CALENDAR(), so every time you refer to that table you would have to put its name in single quotes. I find typing extra quotes around my table names annoying and try to avoid it wherever possible.
So you would be able to type
Measure = CALCULATE( [MeasureName], DATESYTD(DateTable[Date]))
instead of
Measure = CALCULATE( [MeasureName], DATESYTD('Calendar'[Date]))because
Measure = CALCULATE( [MeasureName], DATESYTD(Calendar[Date]))
would return an error.
- Anonymous9 years agoNot applicable
The purpose of the DATE() function is to construct dates from components. It requires 3 separate arguments: a year, a month, and a day, each in the form of a whole number, and from that it returns a single item as its output: a full date. TODAY() takes no arguments, and also returns a single item: a full date. So TODAY() when nested in another function only constitutes one argument, not three, and also it doesn't fit the requirements of any of the three arguments needed for DATE(). It isn't a year, it isn't a month, and it isn't a day. It's a full date.
- Stuk9 years agoHelper I
thank you very much it's alright now !
- Amzad8 years agoFrequent Visitor
Hey Stuk, what was work aound to achive the DAX comand As i have Dates from 2009 till 2027 and more
i need DAX command from 2016 till date like today Can you help me Thanks in advance