Forum Discussion

Paulo84's avatar
Paulo84
Frequent Visitor
3 years ago
Solved

Forecast based on what-if parameter commencing after actuals

Hi Team,  I have an issue which probably has an incredibly simple solution, but which I can't seem to find!  I have a model which has two what if paramteres - "monthly defections" and "monthl...
  • onurbmiguel_'s avatar
    3 years ago

    Hello Paulo84

     

    please see see this possibility:

     

    Project open accounts = 
    var _periode = SELECTEDVALUE('Table'[Year_Month_ID])+1 - (YEAR(TODAY())*100+MONTH(TODAY()))
    
    var _last_month = 
        CALCULATE(
            MAX('Table'[Year_Month_ID]),
            FILTER(ALL('Table'),'Table'[Open Accounts]<>BLANK())
        )
    
    var _value = 
        CALCULATE(
            sum('Table'[Open Accounts]),
            FILTER(ALL('Table'),'Table'[Year_Month_ID]=_last_month)
        )
    
    return 
    if( 
        [Total Open Accounts] = BLANK(), 
        _periode*[Project Monthly Member Gain] + _value,
       BLANK()
    )

     

    also i share an example so can compare with yours in the following LINK:

     

    max by category.pbix

     

     

    Best regards

    Bruno Costa | Solution Supplier

     

    Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! πŸ‘

    Take a look at the blog: PBI Portugal 

  • Paulo84's avatar
    3 years ago

    Thanks for reply onurbmiguel_ ! 

    Unfortunately, your solution didn't quite work with my existing measures - However, I tweaked it slightly to produce the outcome I was looking for:

    Forecast open accounts = 
    
    VAR _date = SELECTEDVALUE('DATE'[End of month])
    
    VAR LatestDate =
        CALCULATE(
            MAX('DATE'[end of month]),
            FILTER(ALL('DATE'), NOT(ISBLANK([Total Open Accounts])))
        )
    
    VAR MonthNumDifference = 
    
        CALCULATE(
            DATEDIFF(LatestDate, _date, MONTH)
        )
    
    VAR LatestCount =
        CALCULATE(
            [Total Open Accounts],
            FILTER(ALL('DATE'), 'DATE'[end of month] = LatestDate)
        )
    
    VAR NetMbrGain = [Projected Monthly Mbr Gain]
    
    VAR MonthlyDefections = 'Parameter - Monthly Defections'[Parameter Value]
    
    RETURN
    
    IF(
        _date <= LatestDate, 
        BLANK (), 
        (NetMbrGain * MonthNumDifference) + LatestCount 
    )

     
    Many thanks for your assistance!