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
cosminc
Post Partisan
Post Partisan

DAX - Calculate forecast in cascade depending by previous month also forecasted in same column table

Hi all,

 

is there a way to calculate forecasted values in cascade?

 

let's say we have a table like this:

 

Year-Month   Value   

2019-10         5            

2019-11         7             

2019-12          8           

 

and i want to obtain a table like this:

Date                     Value

2019-10         5

2019-11         7

2019-12         8

2020-01         2019-12 *evolution index between 2019-12 and 2019-11

2020-02         2020-01 *evolution index

2020-03         2020-02 * evolution index

 

so the idea is how to create a dax where you can use also forecasted data from previous month in same column, in cascade?

a measure or a column in dax

 

Thanks,

Cosmin

 

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @cosminc 

This is possible.

Please tell me the forecasting rule.

We can create a measure like:

measure=if(max(date[date])<=[specific date], [actual value],[forecast value])

I need more information to accomplish the measure.

 

Besides, you can refer to a simple way to forecast via visuals.

https://www.youtube.com/watch?v=XIlPkyyztho

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks,

 

forecast measure i need to calculate it, not bi.

as measure, i have a given formula; you can built any chain in cascade.

also i need to calculate month by month but to vizulize by quarter.

 

 

follow your measure

measure=if(max(date[date])<=[specific date], [actual value],[forecast value])

where actual data are till November 2019 and i need to create a rule in measure or in column to compute values on 3rd column in below visual

i want VAR forecast_value = value from previous month + 1

please have in mind that forecast_value is more complex in real base, but it's based on value from previous month from a column and some coefficients and other value from other column but from previous month.

in my measure third column stops on dec 2019 where i use value from last actual month; i need to obtain a chain of values till dec 2020 in cascade, based on previous month, so from jan 2020 i need to use calculated value from dec 2019.

 
 

ex.jpg

Thanks a lot.

Cosmin

Hi @cosminc 

Create a measure

Capture2.JPG

forecast =
VAR lastdate1 =
    CALCULATE (
        LASTDATE ( 'date'[Date] ),
        FILTER (
            ALLSELECTED ( 'Table 3' ),
            'Table 3'[actual]
                <> BLANK ()
        )
    )
VAR previousmonthvalue =
    CALCULATE (
        SUM ( 'Table 3'[actual] ),
        FILTER (
            ALLSELECTED ( 'date' ),
            DATEDIFF (
                'date'[Date],
                MAX ( 'date'[Date] ),
                MONTH
            ) = 1
        )
    )
RETURN
    IF (
        MAX ( 'date'[Date] )
            > EOMONTH (
                lastdate1,
                0
            ),
        previousmonthvalue + 1,
        SUM ( 'Table 3'[actual] )
    )

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

i see in your pbix you have same results as me =1 for future months; doesn't follow the cascade.

sep 2020 or dec 2020 - value is 1

i need to calculate in cascade dec 2020 in connection with nov 2020...nov 2020 depending oct 2020 and so on.

do i miss something?

 

i need like this

YearMonthactualforecast
2019January25.4725.47
2019February25.6125.61
2019March25.4425.44
2019April25.5625.56
2019May25.5225.52
2019June25.6525.65
2019July24.9724.97
2019August25.3125.31
2019September26.0726.07
2019October24.9624.96
2019November25.2425.24
2019December26.24
2020January 27.24
2020February 28.24
2020March 29.24
2020April 30.24
2020May 31.24
2020June 32.24
2020July 33.24
2020August 34.24
2020September35.24
2020October 36.24
2020November37.24
2020December38.24

 

Thanks,

Cosmin

 

 

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