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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

How to manually calculate liner and logarithmic trend forecast for next 6 months

I need to calculate AvgPatients for coming 6 months using below linear and logorothemic trend formulas

  • A -Linear trend formula: Y= M*X + C
  • B -Logarithmic trend formula: Y= B1*ln(X) + B0
  • Avg patients for coming 6 months = 70*A+ 30*B  

My Data like this..

sveeramreddy_0-1602168300771.png

I need to caluculate all forecast data using above formulas and create visual like below   
 

sveeramreddy_0-1602169409988.png

 

 

 

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

I'm not clear about the following formulas, could you please explain it with some examples? M,X,A,B and C in the formula means fields or something else? How are the data of the current date and the data of the future date calculated? And if it involve any calculation, please provide the related calculation logic. As checked the visual screenshot, there are 4 lines on it. What does each line represent?


  • A -Linear trend formula: Y= M*X + C
  • B -Logarithmic trend formula: Y= B1*ln(X) + B0
  • Avg patients for coming 6 months = 70*A+ 30*B  

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Due to forecast single line issue, I am manually calculating liner trend.

I calculated liner trend using below formula in a mesure but how to calculate for coming 6 months and how to display forecast data in different color

LinearTrend-A-MB =
VAR Known =
FILTER (
SELECTCOLUMNS (
CALCULATETABLE ( VALUES ( PatientsNormalized[Date] ), ALLSELECTED ('PatientsNormalized') ),
"Known[X]", 'PatientsNormalized'[Date],
"Known[Y]", PatientsNormalized[A-MB]
),
AND ( NOT ( ISBLANK ( Known[X] ) ), NOT ( ISBLANK ( Known[Y] ) ) )
)
VAR Count_Items =
COUNTROWS ( Known )
VAR Sum_X =
SUMX ( Known, Known[X] )
VAR Sum_X2 =
SUMX ( Known, Known[X] ^ 2 )
VAR Sum_Y =
SUMX ( Known, Known[Y] )
VAR Sum_XY =
SUMX ( Known, Known[X] * Known[Y] )
VAR Average_X =
AVERAGEX ( Known, Known[X] )
VAR Average_Y =
AVERAGEX ( Known, Known[Y] )
VAR Slope =
DIVIDE (
Count_Items * Sum_XY - Sum_X * Sum_Y,
Count_Items * Sum_X2 - Sum_X ^ 2
)
VAR Intercept = Average_Y
- Slope * Average_X
RETURN
SUMX ( DISTINCT ( PatientsNormalized[Date] ),
Intercept + Slope * PatientsNormalized[Date]
)

Hi @Anonymous ,

You can refer the following threads to achieve it.

Forecasting Logic in Power BI with DAX

How to calculate future months

Weekly Forecast

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Calculated Liner regression Y= mx+c using below calculation

LinearTrend-A-MB = 
VAR Known =
FILTER (
SELECTCOLUMNS (
CALCULATETABLE ( VALUES ( ConsumptionDate[DateNumber] ), ALLSELECTED (ConsumptionDate) ),
"Known[X]", 'ConsumptionDate'[DateNumber],
"Known[Y]", PatientsNormalized[A-MB]
),
AND ( NOT ( ISBLANK ( Known[X] ) ), NOT ( ISBLANK ( Known[Y] ) ) )
)
VAR Count_Items =
COUNTROWS ( Known )
VAR Sum_X =
SUMX ( Known, Known[X] )
VAR Sum_X2 =
SUMX ( Known, Known[X] ^ 2 )
VAR Sum_Y =
SUMX ( Known, Known[Y] )
VAR Sum_XY =
SUMX ( Known, Known[X] * Known[Y] )
VAR Average_X =
AVERAGEX ( Known, Known[X] )
VAR Average_Y =
AVERAGEX ( Known, Known[Y] )
VAR Slope =
DIVIDE (
Count_Items * Sum_XY - Sum_X * Sum_Y,
Count_Items * Sum_X2 - Sum_X ^ 2
)
VAR Intercept = Average_Y
- Slope * Average_X
RETURN
SUMX( DISTINCT ( ConsumptionDate[DateNumber] ),
Intercept + Slope * ConsumptionDate[DateNumber]
)

Please help me how to calculate logarithemic regression :  Y = a + b * ln (X) ? 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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