Forum Discussion
DAX Query Format Date
- 7 months ago
You can use the following DAX query to return only a formatted date, avoiding the ugly datetime string when copying to Excel:
EVALUATE
SELECTCOLUMNS(
Bookings,
"xDate", FORMAT(Bookings[Date], "MM/DD/YYYY")
)- This will output only the xDate column with dates formatted as MM/DD/YYYY.
- Excel will see the result as plain text, so the original datetime format like Wed, 01 Jan 2025 00:00:00 is avoided.
- You don’t need to reference the original Bookings[Date] column separately, which keeps your solution clean and avoids violating DRY principles.
If this answer helped, please click Kudos or Accept as Solution.Best regards,
Vaibhav Mahajan
- 7 months ago
Hi tecumseh ,
it looks a bit unusual how you use SUMMARIZECOLUMNS because you group by Bookings[Date] and then repeat Bookings[Date] as the calculated column for every group.
Depending on your needs, the following two options could help you:
1) SELECTEDVALUE doesn't really care about the group by. If you really need a similar expression to the one you mentioned you can try to replace SELECTEDVALUE by VALUES
2) If 1) is not a solution for you, it would be helpful to get a better understanding of what exactly you wanna do. Do you need for example only the distinct values of Booking[Date]?
Thanks Hans-Georg_Puls
There are other columns as well I removed to separate the wheat from the chaff.
At then end of the day, I want a date in US Format: "MM/DD/YYYY"
Prefer no other date columns.
Thanks,
w