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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

calculate slope where x is a date field

Good morning

 

Using the web, I have a formula to give me a slope value. However I have 2 problems and i would like your guidance on it.

 

Problem 1. I need the measure to only look at the past 90 days.

Problem 2.  The Y value is stored as a 1 or 0 to indicate when an event happens. The event can happen multiple times a day and it the count of those events which i need to form my Y value in the calculation.

 

How would I modify the measure below to address my two problems.

 
Slope =
Var AvgX = CALCULATE(AVERAGE(MyAICount[Created]),all (MyAICount))
Var AvgY = CALCULATE(AVERAGE(MyAICount[Value]),all(MyAICount))
Return Divide(SUMX(MyAICount,(MyAICount[Created]-AvgX) * (MyAICount[Value] -AvgY)),
              SUMX(MyAICount,(MyAICount[Created]-AvgX) * (MyAICount[Created] - AvgX)))
 
here is the formula i am trying to replicate
Elohelae_0-1663747365105.png

Apart from the date issue, i think my issue is that after the "average" function in the varx and var y, i need to count the number of events per day and i do not know how to.

 

I look forward to any assistance.

 

Lola

 

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Refer the following article ,and check if it is helpful:

https://www.mrexcel.com/board/threads/calculate-slope-value-in-powerbi-for-given-x-and-y-values.1173085/ 

 

 

Best Regards

Lucien

Anonymous
Not applicable

@v-luwang-msft Good morning. The formaula i used came from that site. I would appreciate help modifying the formula as I described above.

 

Lola

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.