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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
rainynights
Helper II
Helper II

Making measure to calculate gradient of trend line.

So right now I have a table that sorts by count of each product sold. Upon mouse over, it displays the growth over time of that product.

 

This short gif illustrates that:
https://i.gyazo.com/1c75c33c9c1e7d760e910d9ad0589edb.mp4

 

What I want to do is to be able to include a figure for the growth rate of that product (deduced from the trend line), then I could make a table for like the top 5 growth rates, and use that information to say something like "these product's have the fastest growing demand, we should take particular care to ensure we have enough supplies to make them."

1 ACCEPTED SOLUTION

Hi @rainynights 

It seems impossible in Power BI.

There is a workaorund with R.

In this formula, the second one is gradient of trend line.

Capture19.JPG

 

https://community.powerbi.com/t5/Desktop/Formula-for-trendline/m-p/86449#M36271

https://stackoverflow.com/questions/24882209/how-to-get-trendline-equations-in-r

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @rainynights 

It should be possible in Power BI.

Please show some sample data or data structure so i can make a test for your scenario.

Here are some examples:

https://docs.microsoft.com/en-us/power-bi/desktop-analytics-pane#apply-forecasting

https://docs.microsoft.com/en-us/power-bi/desktop-tooltips#custom-report-tooltips-and-line-charts

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-juanli-msft , thanks for the response!

 

I made a very simple example table here that uses the exact same premise:

https://1drv.ms/u/s!AqOYqK3B8ETjbiaCBoBBQdLMhvo?e=Tn0lJb

 

This just breaks down the category of fruit eaten by date!

 

Here's a snippet from that:

 

When I mouseover Apple, I see apple consumption over time, and the trend line. What I'd like to do is include a 3rd column (in addition to the existing two) that lists the gradient of this trend line for each unique fruit!

Hi @rainynights 

It seems impossible in Power BI.

There is a workaorund with R.

In this formula, the second one is gradient of trend line.

Capture19.JPG

 

https://community.powerbi.com/t5/Desktop/Formula-for-trendline/m-p/86449#M36271

https://stackoverflow.com/questions/24882209/how-to-get-trendline-equations-in-r

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors