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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
EC22
Frequent Visitor

How to use make date the x-axis on a scatter chart without converting it to a number

Hello Power BI Community, 

 

I am currently working on a project that needs to have the date on the x-axis as some other measurement on the y-axis. There will be multiple points for each date which is why I chose to use a scatter chart, but the limitation on this is that both axes need to be numeric. To bypass this, I just switched the Date type in the power query editor to fixed decimal number. As a result, all my dates are like 40213. It's functional, but I was wondering if there is a way to get pass this, because it doesn't look very pleasing to see a bunch of numbers that I don't know the real value of. 

 

Thanks in advance!

18 REPLIES 18
Pragati11
Super User
Super User

Hi @EC22 ,

 

Not sure why you chose Scatter chart to visualise your data when you want DATE on x-axis.

I would suggest you use other charts like Line chart, clustered column chart, bar chart, etc.

Pragati11_0-1659370681958.png

Scatter chart only allows you to plot 2 numeric values against eachother. Something shown below:

Pragati11_1-1659370858610.png

Hope the explanation helps.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @Pragati11 

The reason why I am using a scatter chart is because there will be multiple values per date, and I don't want to aggregate them together using mean, median, max, etc. From what I understand about a line plot, it can only plot one y-value for each x value. So that's why I'm using a scatter chart. The main challenge is that although I can do something like that with a scatter chart, it requires me to make date numeric, which is fine for the functionality, but it doesn't look good on the visualization. 

Hi @EC22 ,

 

I am really not sure what visual you get putting Date on x-axis of a scatter chart.

Do share some details there like screenshots, etc.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

 

Are you doing something like this?

Pragati11_0-1659372896342.png

Add more details here.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 Hello, here's just a quick set I made. If I kept date as the Date type, it wouldn't allow me to plot both points for each date. So then I had to convert it to a number. 

EC22_0-1659374778816.png

 

Hi @EC22 ,

 

Please send me a complete screenshot like my screenshot in previous reponse , for your scatter plot chart - which shows Fields section for the visualisation as well.

 

I am able to move a date datatype DATE column on scatter chart as shown in my previous response.

I am attaching the screenshot again here:

Pragati11_0-1659380207824.png

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hello @Pragati11 , 

Thank you for your response. I attached another screenshot:

EC22_0-1659380625921.png

 

HI @EC22 ,

From you screenshot, I can clearly see your DATE column is not of date datatype:

Pragati11_0-1659457438153.png

When a column is of date datatype, you have a calendar iocn against it, something like below:

Pragati11_1-1659457490605.png

Can you click on your column in Power BI and see on top ribbon it's datatype please?

It should be date, but it looks like TEXT to me in your case.

 

To check datatype --> click on your column --> on top ribbon:

Pragati11_2-1659457595295.png

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 

I noticed that the calendar icon was not next to DATE also. But then when I checked the ribbon, it says that it is: 

EC22_0-1659458302852.png

 

Hi @EC22 ,

 

This doesn't seem to be right.

Is it possible to share your pbix file with me?

You can share a dropbox link or via WeTransfer.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 This is my first time using a Dropbox link so hopefully it works. Let me know if you need me to send it again. https://www.dropbox.com/s/pskggw8gie4s3fa/Date_x_axis.pbix?dl=0

HI @EC22 ,

 

I reloaded your data by using the sample that you provided in your earlier response.

In power query editor I see the right format:

Pragati11_0-1659474112069.png

Then I realised something was wrong with your settings. I enabled tthe following option on your pbix file:

Pragati11_1-1659474232825.png

And now I see the calendar icon against date column in your data:

Pragati11_2-1659474273983.png

Scatter chart also works now:

Pragati11_3-1659474310728.png

So, the issue was because of the settings option that was disabled on your pbix file for Auto date/time.

Once this is enabled everything looks good.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 . I see, it's super close. I think the thing is that I want both points for each date to show up. Currently, I believe it is the value of the y-axis is being summarized. I tried to use don't summarize, but then the same error popped up. Is it able to work on your end?

Hi @EC22 ,

 

You can't move non-summarised values in the scatter chart to the y-axis section.

Try some other chart in that case.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Okay, I'll try to look around. Thank you for all your help. 

Hi @EC22 ,

 

Can you modify the datatype of your date column to DATE please?

Because I am able to use my date column as x-axis in the scatter chart.

If it still doesn't work for you, share some sample data as it is working at my end.

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 

This is the error message I get once I switch it back to DATE. 

EC22_0-1659390379949.png

Here is an example of the kind of data I would like to plot. I would like there to be two points for each date, with Date on the x-axis and Strength on the y-axis. 

DATESTRENGTH
6/15/2018200
6/15/2018173
7/20/2019124
7/20/2019132
12/19/2019159
12/19/2019204

Hi @EC22 ,

 

Are you selecting the following option for the date field?

Pragati11_0-1659426281487.png

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 

I don't think I have an option to do that on the visualizations tab. But I did go into Power Query Editor to change it to the Date data type. 

EC22_0-1659453927334.pngEC22_1-1659454023256.png

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.