Forum Discussion
how to create a date table with DAX code where there is no end date
- 6 years ago
Hey OPS-MLTSD
this article describe how to create a table using DAX:
https://docs.microsoft.com/en-us/power-bi/desktop-calculated-tables
This is the code to create a table with a given start date that ends with a date that is 10 days ahead of today, there are no quotation marks around the end date parameter:
Dates = CALENDAR("2000-01-01", today( ) + 10)Regards,
Tom
Hey OPS-MLTSD ,
this DAX snippet creates Calendar table with a given start Date and a dynamic end date, where the end date is determined by the max invoice date from the table Fact Sale:
Calendar =
var DateStart = "2000-01-01"
--var DateEnd = today() + 10
var DateEnd = MAX('Fact Sale'[Invoice Date Key])
return
CALENDAR(DateStart , DateEnd)
You may also check the DAX function CALENDARAUTO(...): https://dax.guide/calendarauto/
Hopefully, this provides the idea you are looking for.
Regards,
Tom
- OPS-MLTSD6 years ago
Post Patron
I tried the DAX code:
Dates - CALENDAR("2000-01-01","today( ) + 10")
It did not work!
For reference, I am looking at accident dates and I just want to know wha is the dax code I should use with a specified start dat and an unspecidied end date
- TomMartens6 years ago
Super User
Hey OPS-MLTSD
this article describe how to create a table using DAX:
https://docs.microsoft.com/en-us/power-bi/desktop-calculated-tables
This is the code to create a table with a given start date that ends with a date that is 10 days ahead of today, there are no quotation marks around the end date parameter:
Dates = CALENDAR("2000-01-01", today( ) + 10)Regards,
Tom
- OPS-MLTSD6 years ago
Post Patron
Awesome you're the best it works!
- Anonymous6 years agoNot applicable
I tried this and its working:
Dates = CALENDAR( "2000-01-01",TODAY()+ 10 )