Forum Discussion

Jdelgard's avatar
Jdelgard
Regular Visitor
2 years ago

Question regarding DAX formula for calculation value previous month

Hi. 

I have a created a measure that compares the inventory value this month with the previous month. But this value is blank when added to a visual. 

Previous Month =
CALCULATE(COMPACT_STORE_INVENTORY[Lift Inventory Value],
DATEADD(BC_Item[DWDate], -1,MONTH))
 
The lift Inventory value is also calculated with the following formula: 
Lift Inventory Value =
SUMX(
    SUMMARIZE(BC_Item,
    BC_Item[Unit_Cost],
    "Value", SUM(BC_Item[Inventory]) * BC_Item[Unit_Cost]
    ), [Value]
)
 
Any ideas why the Previous Month is blank?
Thanks in advance. 

1 Reply

  • some_bih's avatar
    some_bih
    Icon for Community Champion rankCommunity Champion

    Hi Jdelgard without model and details it is hard to spot issue. Still, try v2 for previous month. You should use some agg.function, like SUM, COUNT ... to use CALCULATE

    Previous Month V2 =
    CALCULATE(
    SUM(COMPACT_STORE_INVENTORY[Lift Inventory Value]),
    DATEADD(BC_Item[DWDate], -1,MONTH))