cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
me418
New Member

How to add Trend line in Line Chart

Hi

 

I've made line chart of Cost by quarter in Power BI as below.

I want to add trend line of this, but there is no Trend line item in Analytics section.

Would you please let me know how to add trend line in this chart?

Thank you. 

me418_0-1623828067634.pngme418_1-1623828087792.png

 

 

 

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@me418 

Use the date column instead of TEXT Year&Quarter on the X-axis like the following. 

Vpazhenmsft_0-1623981733431.png

 

Then you can change the x-axis type to continuous that allows you to add a trend line.

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

9 REPLIES 9
V-pazhen-msft
Community Support
Community Support

@me418 

Use the date column instead of TEXT Year&Quarter on the X-axis like the following. 

Vpazhenmsft_0-1623981733431.png

 

Then you can change the x-axis type to continuous that allows you to add a trend line.

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

SanketBhagwat
Responsive Resident
Responsive Resident

Hi @me418 .

 

If you want to add a trend line then you have to first change your X-Axis type to 'Continuous'.

 

Regards,

Sanket Bhagwat.

 

If this post helps, then please mark it as 'Accept as Solution' so that other members could find it quickly.

 

Hi Sanket Bhagwat, 

 

Thank you for your reply.

but if I select the X-Axis type to 'Continuous', then it's forced to change 'Categorial'.

Is there any option that I have to choose?

SanketBhagwat
Responsive Resident
Responsive Resident

Can you please check the data type of your quarter column?

If it is text, then you will need to convert it into a numeric type as trend line cannot work for text data type.

 

Regards,

Sanket Bhagwat

amitchandak
Super User IV
Super User IV

@me418 , this is a qtr trend, what do mean by trend line?



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Hi AmitChandak, 

 

Yes, The line chart shows quarterly trends itself, but we need trend line which shows tendency of total quarters.  

SanketBhagwat
Responsive Resident
Responsive Resident

Can you please share your data and the output you need?

Hi SanketBhagwat, 

 

Thank you for your response.  

Please refer to the below table and the output I need is a trend line of total quarters like red dotted line below.

Adding trend line works in Excel even though Quarter column is text, but doesn't work in Power BI.

me418_0-1623909854951.png

 

Quarter Rev Cog Mar
FY21 Q1 84.9 54.1 30.7
FY21 Q2 84.0 48.2 35.8
FY21 Q3 81.8 47.0 34.8
FY21 Q4 78.6 47.0 31.6
FY22 Q1 81.5 47.8 33.7
FY22 Q2 79.0 47.8 31.2

SanketBhagwat
Responsive Resident
Responsive Resident

And was the Quarter Column Data already present or you created a calculated column?

 

If so, the QUarter Column needs to be in Date Format and not text.

And you cannot convert Text data type which doesn't contain other data element such as YEAR,MONTH or DAY.

 

You can find more about it on

https://community.powerbi.com/t5/Desktop/How-do-I-organise-data-by-Year-and-Quarter-on-a-line-graph/...

 

 

Regards,

Sanket Bhagwat

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors