Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Subtract two unit quantities based on date slicer

I want to subtract the amount of units in inventory for different product types over a given timeframe. I've created the following dummy data to illustrate: The user should be able to select a...
  • MFelix's avatar
    7 years ago

    Hi Anonymous ,

     

    Add the following measure to your report:

     

    Inventory Variation =
    VAR StartDate =
        MIN ( Inventory[Date] )
    VAR EndDate =
        MAX ( Inventory[Date] )
    RETURN
        CALCULATE (
            SUM ( Inventory[Inventory (Units)] );
            FILTER ( ALLSELECTED ( Inventory[Date] ); Inventory[Date] = EndDate )
        )
            - CALCULATE (
                SUM ( Inventory[Inventory (Units)] );
                FILTER ( ALLSELECTED ( Inventory[Date] ); Inventory[Date] = StartDate )
            )

    Final result is as follows:

    Regards,

    MFelix