Power BI: How to create a scatter plot with X-axis dates?

Viewed 81

I'm trying to create a simple scatter plot, with dates on the X axis and a count of events on the Y axis. In Excel it's easy: Excel recognizes the dates as legitimate axis material and automatically figures out logical increments.

Excel example

But Power BI can't seem to manage that. When I assign the same two columns as I did in Excel, I get a nastygram:

BI error

My date table has a numeric "DayCounter" field, which is a numeric count of days since 1900 or thereabouts. Power BI likes that as an axis, but the increments will mean nothing to a human.

BI chart

How do I get the BI axis to show dates?

1 Answers

Step_1: For [DateCounter] numeric column field, go to the query editor as you can see in the picture below:

Query Editor Section

Step_2: Click the top left corner, and change the data type from whole number to Date.

Change the data type

Step_3: You can see the converted data to date.

dfsadgffg

Step_4: Then exit the query editor, and go on to create the scatter chart. Put the [DateCounter] in the X_axis, and count on the y axis. Done! I tested a similar scenario with a fake data using scatter chart and a slicer to constrain the date column.

Test With Data

Related