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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Raph
Helper III
Helper III

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

1 ACCEPTED SOLUTION
v-yuaj-msft
Community Support
Community Support

Dear @Raph ,

 

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

v-yuaj-msft_0-1603763844920.png

 

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:

v-yuaj-msft_1-1603763870898.png

 

v-yuaj-msft_2-1603763870900.jpeg

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:

v-yuaj-msft_3-1603763923426.png

 

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

 

 

View solution in original post

3 REPLIES 3
v-yuaj-msft
Community Support
Community Support

Dear @Raph ,

 

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

v-yuaj-msft_0-1603763844920.png

 

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:

v-yuaj-msft_1-1603763870898.png

 

v-yuaj-msft_2-1603763870900.jpeg

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:

v-yuaj-msft_3-1603763923426.png

 

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

 

 

danno
Resolver V
Resolver V

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 ###############

Dear @danno 

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.