Forum Discussion

Raph's avatar
Raph
Helper III
5 years ago
Solved

Dax studio csv export - Problem on date format

Hello,

 

I have a table that I want to export on csv with Dax Studio with a simple Date field formated as AAAA-MM-DD

When I open the csv file exported by Dax Studio , the dates fields are systematically modified on AAAA-MM-DD 00:00:00,000

 

Can anyone tell me how to fix this?

 

Thank you very much!

Raphaël

  • Anonymous's avatar
    Anonymous
    5 years ago

    Dear Raph ,

     

    If you do not make any changes, the result of exporting .csv is shown in the figure below.

     

    Based on your description, I suggest that you can use the FORMAT option in DAX query in DAX Studio to control the format of the output content.

     

    Command:

    EVALUATE
    SELECTCOLUMNS('table',"Date",FORMAT([Date],"YYYY-MM-DD"))

     

    Test result:

     

    Obviously, although the date format adjusted in DAX studio is the expected "YYYY-MM-DD", the exported .csv file is still not in the format we want. This is because "YYYY-MM-DD" in the .csv file is date type by default, but the default format of "Date" is "MM-DD-YYYY".

    Therefore, I suggest that you can enter a space before "Y" to convert the Date format into a Text format manually.

     

    Command:

    EVALUATE
    SELECTCOLUMNS('table',"Date",FORMAT([Date]," YYYY-MM-DD"))

     

    Test results:

     

    I hope my suggestion can give you some help.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Yuna

     

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    if you use the FORMAT option in the DAX query in DAX Studio, then you can control the output.  Here is a simple query on a Date Table using FORMAT. 

    EVALUATE
    SELECTCOLUMNS('Date', "Date", FORMAT([Date], "DD-MM-YYYY"), "DateKey", [DateKey])

    ###### Please Give Kudos if this answers your question ###############

    • Raph's avatar
      Raph
      Helper III

      Dear Anonymous 

       

      Thank you for your message. I think someting is missing in my understanding of your post.

      What do you mean by "use the FORMAT option in the DAX query"?

      If I run the query as showed in your exemple, it works on the pane "Results" but it doesn't change anything for the export.

      So I guess I am missing something.

       

      Thank you

       

      Raphaël

  • Anonymous's avatar
    Anonymous
    Not applicable

    Dear Raph ,

     

    If you do not make any changes, the result of exporting .csv is shown in the figure below.

     

    Based on your description, I suggest that you can use the FORMAT option in DAX query in DAX Studio to control the format of the output content.

     

    Command:

    EVALUATE
    SELECTCOLUMNS('table',"Date",FORMAT([Date],"YYYY-MM-DD"))

     

    Test result:

     

    Obviously, although the date format adjusted in DAX studio is the expected "YYYY-MM-DD", the exported .csv file is still not in the format we want. This is because "YYYY-MM-DD" in the .csv file is date type by default, but the default format of "Date" is "MM-DD-YYYY".

    Therefore, I suggest that you can enter a space before "Y" to convert the Date format into a Text format manually.

     

    Command:

    EVALUATE
    SELECTCOLUMNS('table',"Date",FORMAT([Date]," YYYY-MM-DD"))

     

    Test results:

     

    I hope my suggestion can give you some help.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best Regards,

    Yuna