cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

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
Community Support

Hi @Anonymous ,

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

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors