Forum Discussion
Display Whole Number as Date
I'm trying to get a date as the x axis for a scatter plot, which Power BI refuses to allow. As a workaround, converting the date to a whole number allows for plotting this along the x axis. However, the labels are now in whole number format instead of date (43466 vs 1/1/2019). Is there a way to hack the format string of a whole number to display the result as a date while keeping the underlying data type as a whole number?
I can put a date on the X axis. Put your date there, and data on the Y axis.
You can convert datevalue (43466) to date (e.g. 03/06/2019) using the following formulas:
DAX
Date = Format(Date[DateValue],"mm/dd/yyyy")
Power Query:
Date = CONVERT(Date[DateValue], DATETIME)
Make sure though that the field is numeric .. If it is text convert to numeric first (best to do in Query Editor - Power Query).
2 Replies
- edhans
Community Champion
I can put a date on the X axis. Put your date there, and data on the Y axis.
- themistoklis
Community Champion
You can convert datevalue (43466) to date (e.g. 03/06/2019) using the following formulas:
DAX
Date = Format(Date[DateValue],"mm/dd/yyyy")
Power Query:
Date = CONVERT(Date[DateValue], DATETIME)
Make sure though that the field is numeric .. If it is text convert to numeric first (best to do in Query Editor - Power Query).