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
nawillia711
Helper I
Helper I

Calculating a Forecast looking at Previous Values

Hello,

 

What I am trying to do is calculate a forecast using the previous row's number. So for the first row of the column "forecast" the formula is summing all the numbers in column "S." Then for every other row it uses the previous "Ending" value. Just need to know if/how this would be possible in Power BI.

 

DateSUGForecastEnding (U-G+Forecast)
1/01/20200.080.240.684.86-3.94
31/12/20190.530.340.96-3.945.24
30/12/20190.240.390.325.24-4.53
29/12/20190.600.880.58-4.535.99
28/12/20190.840.520.135.99-5.34
27/12/20190.600.290.01-5.345.64
26/12/20190.710.620.125.64-4.90
25/12/20190.710.300.59-4.905.78
24/12/20190.550.620.035.78-5.13
3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @nawillia711 ,

 

 

Create a Calculated Column

 

Ending =
VAR filterdate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER (
            'Table',
            'Table'[Date]
                < EARLIER ( 'Table'[Date] )
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[Forecast] ),
        FILTER (
            'Table',
            'Table'[Date] = filterdate
        )
    )

 

 

1.jpg

 

 

Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

Greg_Deckler
Super User
Super User

@nawillia711 - Should be possible, but tough to understand your description. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Basically what I would like to do is if row 1 of the column "ending" is showing the value 2, then row 2 of the column "forecast" should return 2 as its number. The if row 2 of "ending" shows 1.5 then row 3 of "forecast" would show 1.5 etc. Does that make more sense?

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.

Top Solution Authors