Forum Discussion

jrhaney23's avatar
jrhaney23
Frequent Visitor
4 months ago
Solved

Sales Summary - Order Demand vs. Forecast Demand

Hello, I am trying to develop a better relationship with order data vs. forecast data for a range of forecasted materials. In the shared workbook, you will find a "Forecast" and an "Order vs. Forecas...
  • v-hashadapu's avatar
    v-hashadapu
    4 months ago

    Hi jrhaney23 , yes, Use your dimension tables dCustomer, dMaterial and connect them:

     

    fOrder[Customer] --> dCustomer[Customer]  
    fForecast[Customer] --> dCustomer[Customer]  
    fOrder[Forecast Material] --> dMaterial[Forecast Material]  
    fForecast[Forecast Material] --> dMaterial[Forecast Material]

     

    Use "ALL(dDate)"  instead of "REMOVEFILTERS"

     

    Use FILTER instead of direct column filters.

     

    Please try below updated DAX measures.

     

    Locked Forecast =
    VAR SelectedMonth =
        MAX ( dDate[Date] )

     

    VAR LockedMonth =
        EDATE ( SelectedMonth, -4 )

     

    RETURN
    CALCULATE (
        SUM ( fForecast[Total Reel Demand] ),
        ALL ( dDate ),
        FILTER (
            fForecast,
            fForecast[Month] = SelectedMonth
    && fForecast[Forecast Key] = LockedMonth
        )
    )

     

     

    Current Forecast =
    VAR SelectedMonth =
        MAX ( dDate[Date] )

     

    RETURN
    CALCULATE (
        SUM ( fForecast[Total Reel Demand] ),
        ALL ( dDate ),
        FILTER (
            fForecast,
            fForecast[Month] = SelectedMonth
    && fForecast[Forecast Key] = SelectedMonth
        )
    )

     

     

    If you are facing any grand total inconsistencies, Please try below DAX.

     

    Locked Forecast =
    SUMX (
        VALUES ( dDate[Date] ),
        VAR SelectedMonth = dDate[Date]
        VAR LockedMonth = EDATE ( SelectedMonth, -4 )
        RETURN
            CALCULATE (
                SUM ( fForecast[Total Reel Demand] ),
                ALL ( dDate ),
                FILTER (
                    fForecast,
                    fForecast[Month] = SelectedMonth
    && fForecast[Forecast Key] = LockedMonth
                )
            )
    )