Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Dicken
Continued Contributor
Continued Contributor

DAX DATATABLE

 

 

Hi, 
  I don't think the data type DATETIME availabel in DATATABLE works,  as in a date time should work as a date / time
but 

Dtable =
DATATABLE( "dDate" ,STRING,
{
    {"01/01/2020"}
} )
 
but to have an actual date ; 

 so something like 
Dtable =
DATATABLE( "dDate" ,DATETIME ,
{
   DATE(2020,1,1)+TIME(0,0,0)
} )  
but I cannot get anything to work, so is the DATETIME type usable. perhaps someone could look into this?

Richard. 
1 ACCEPTED SOLUTION

Ran it on my machine. That function does not seem to like non hard coded values. This worked

 

Dtable =
DATATABLE( 
"dDate", DATETIME ,
{{"01/01/2020"}}
)  


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

9 REPLIES 9
v-echaithra
Community Support
Community Support

Hi @Dicken,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

Chaithra E.

v-echaithra
Community Support
Community Support

Hi @Dicken ,

 

We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @Dicken ,

Try this DAX expression: 

Dtable =
DATATABLE (
"dDate", DATETIME,
{
{ DATE(2020, 1, 1) + TIME(0, 0, 0) }
}
)

v-echaithra
Community Support
Community Support

Hi @Dicken,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

Chaithra E.

Dicken
Continued Contributor
Continued Contributor

I have not had a response that works, regarding DATATABLE function, 
so I don't think it is possible, I did use the 'enter data'  option, to give a  two date table for first and last. 
Richard. 

Deku
Super User
Super User

This should work add a extra {} for the row
Dtable =
DATATABLE
"dDate"DATETIME ,
{{DATE(2020,1,1)}}
)  

Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Dicken
Continued Contributor
Continued Contributor

I don't know if you got it to work but I get this ; 

The tuple at index '1' from the table definition of the DATATABLE function does not have a constant expression in the column at index '1'

Ran it on my machine. That function does not seem to like non hard coded values. This worked

 

Dtable =
DATATABLE( 
"dDate", DATETIME ,
{{"01/01/2020"}}
)  


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Dicken
Continued Contributor
Continued Contributor

I don't think it will work,  I wanted a two date tabel that could be used by 
canender, in the end I just used Enter data whch does work. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.