Forum Discussion

kqian's avatar
kqian
Regular Visitor
5 years ago
Solved

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.

     

  • kqian 

     

    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's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    I can put a date on the X axis. Put your date there, and data on the Y axis.

     

  • themistoklis's avatar
    themistoklis
    Icon for Community Champion rankCommunity Champion

    kqian 

     

    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).