Forum Discussion

Techyy55's avatar
Techyy55
New Member
2 years ago
Solved

How to calculate delta inventory value

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Techyy55 ,

     

    Please create a Dimdate to help your calculation.

    DimDate =
    ADDCOLUMNS (
        CALENDARAUTO (),
        "Year", YEAR ( [Date] ),
        "Month", MONTH ( [Date] ),
        "Day", DAY ( [Date] ),
        "YearMonth",
            YEAR ( [Date] ) * 100
                + MONTH ( [Date] )
    )

    Data model:

    Measure:

    Select Date = 
    CALCULATE(SUM('Table'[Value]))
    Delta Inventory Value = 
    VAR _SELECTMONTH=SELECTEDVALUE(DimDate[Month])
    VAR _SELECTDAY = SELECTEDVALUE(DimDate[Day])
    RETURN
    IF(_SELECTMONTH = 2 && _SELECTDAY = 29,BLANK(),CALCULATE([Select Date],SAMEPERIODLASTYEAR(DimDate[Date])))

    Result is as below.

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.