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
dtan
Regular Visitor

Scatterplot trend line does not go through data

I am adding a trend line to a scatterplot. As you can see in the attached screen shot, the line does not go through the data. I cannot figure out what is going on here. In fact, two of my colleagues have looked at this and we're all stumped.

 

Things we've tried:

  • Turning off all filters and slicers
  • Filtering out blank values
  • Filtering out values beyond the visible axes
  • Turning off all axis limits (i.e., there is no data beyond the visible axes that could be pulling the line)

The line does respond to changes in filters: if we turn filters/slicers on and off, the line will shift, but it never actually goes through the displayed data.

Are there any other things that we should look at?

 

Edit/Update:

The y-axis is on a log scale. If I change the scale to linear, the line works properly. So, This appears to be a bug. When the y-axis is changed to log, the trend line continues to be on a linear scale. Is there any way to fix this?

Screen shot of y-axis on a linear scale (same data) added for comparison.

 

Log scale:

Capture.JPG

 

Linear scale:Capture1.JPG

 

 

5 REPLIES 5
Anonymous
Not applicable

Hi! I'm facing the exactly same issue here. Is there any workaround except creating a custom visual by myself?

v-shex-msft
Community Support
Community Support

Hi @dtan ,

Can you please share some sample data for test? It is hard to test without any sample data.

How to Get Your Question Answered Quickly

Notice: please do mask on sensitive data before share

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Sure.  Here is a table of log-linear data that I created with python:

 

xy
11000
2784.76
3615.8482
4483.293
5379.269
6297.6351
7233.5721
8183.2981
9143.845
10112.8838
1188.58668
1269.51928
1354.55595
1442.81332
1533.59818
1626.36651
1720.69138
1816.23777
1912.74275
2010

 

When I plot this in PowerBI with y on a linear scale, the trend line is correct. When I plot with y on a log scale, the trend line no longer goes through the data.

 

Linear scale:Capture.JPG

 

Log scale:

 

Capture1.JPG

 

The data were created so that the relationship is perfectly log-linear, and the line should go exactly through the datapoints. Here is a plot I made with the data in python with the y data plotted as log10(y):

Capture2.JPG

 

 

 

 

Hi @dtan ,

I can reproduce your scenario.
I build a table from your sample data and add a calculated column based y column, trend line works well as the result that your python code generated.

 

logY = LOG10([y])

 

6.png

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks -- unfortunately with this fix (as in my Python demo) is that the y-axis is now in log-units. 

 

The ideal scenario we're trying for is to have the y-axis in their original units (e.g., 1, 10, 100), but with their spacing on a log scale, and the trend line reflecting the linearized relationship *after* the log transform.

 

I can't find a clear way to plot the log-transformed datapoints with the values on the y-axis in the original scale, but with the trend line showing the now linearized relationship in PowerBI.

 

In scripting-based plotting tools you can generally apply values to the y-axis for display purposes (e.g., have 1, 10, and 100, equispaced along the y-axis), while plotting the log-transformed data with the appropriate trendline. Is this possible in PowerBI? Is there a hacky workaround that can be done to display the y-axis in the original units, while plotting the log transformed data with trend line?

 

More generally, it seems less than ideal to have a trendline *not* go through data after the axis is changed to a log scale (independent of my particular problem -- this is a platform-level issue).

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.