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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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