Forum Discussion

Dicken's avatar
Dicken
Post Prodigy
1 year ago
Solved

DAX DATEATABLE Function

 

 

Hi, 
is there a way I can create a small start end date table using this function   

example of what i want  ; 


dtab =
DATATABLE(
    "start",STRING,
    "end", STRING,
    {
      {"01/01/2020", "31/12/2020"}
    }
)
  But not as text but as  a 'date'    I have tried ; 

dtab =
DATATABLE(
"start", DATETIME,
"end", DATETIME,
{
{ DATE(2020, 1, 1) + TIME(0, 0, 0), DATE(2020, 12, 31) + TIME(23, 59, 59) }
}
)

I added the time as even though I don't need it I thought it might be the problem, but it still does not work? 

any suggestions? 

Richard. 



  • Dicken's avatar
    Dicken
    1 year ago

    Does not seem to work, yes returns a table, but 
    CALENDARAUTO does not find it, so not much use. 
    Richard. 

5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Dicken I know it looks like it won't work but just do this:

    dtab = 
    DATATABLE(
        "start",DATETIME,
        "end", DATETIME,
        {
          {"01/01/2020", "31/12/2020"}
        }
    )
    • Dicken's avatar
      Dicken
      Post Prodigy

      Does not seem to work, yes returns a table, but 
      CALENDARAUTO does not find it, so not much use. 
      Richard. 

  • Why not use calendar function? 

    dtTable = CALENDAR ( StartDate, EndDate )
    • Dicken's avatar
      Dicken
      Post Prodigy

      becaue I want to use the start month feature of auto. 
      besides which that is not answering the queston. 

       

  • Not sure why that didn't answer the question. why not you define the problem statement