Semi additive explanation

  • I've read in loads of different books/places that when we are dealing for example with an inventory the stock number is a semi additive and you can add it up by product. I really don't understand this affirmation and i would like to ask your help to understand it.

    How can a stock number be additive by product ? Imagine that i have this situation

    Product / Store / Date / Stock

    A,LX,01-01-2014,10

    A,LX,02-01-2014,5

    If i sum it up by product i will have 15 for product A ? Does it make any sense ? I never had stock of 15 for the product A. When they say that is additive by product its not the same as (select sum(stock) group by product ? )

    Thanks, T

  • Semi-Additive means that it makes sense to sum it by some dimensions, but not all.

    In your case, summing Products over multiple dates makes no sense, but summing by Store for a single date does.

    ProductStoreDateStock

    ALX01-01-201410

    ASF01-01-20145

    ANY01-01-20147

    ALX02-01-201412

    ASF02-01-20146

    ANY02-01-20147

    SELECTProduct

    ,SUM(Stock) StockLevel

    FROMFactSales

    GROUP BYProduct

    WHEREDate='1/1/2014'

    StockLevel = 22

  • Thank you for your help 🙂

    I was basically thinking that i had to ignore completely the Date dimension and i thought you would have to analyze the full table and not for a single date.

    Thank you again.

    gmontanaro (10/22/2014)


    Semi-Additive means that it makes sense to sum it by some dimensions, but not all.

    In your case, summing Products over multiple dates makes no sense, but summing by Store for a single date does.

    ProductStoreDateStock

    ALX01-01-201410

    ASF01-01-20145

    ANY01-01-20147

    ALX02-01-201412

    ASF02-01-20146

    ANY02-01-20147

    SELECTProduct

    ,SUM(Stock) StockLevel

    FROMFactSales

    GROUP BYProduct

    WHEREDate='1/1/2014'

    StockLevel = 22

  • well put G.

    Just to add to the discussion. If you wanted to be able to SUM() across the date dimension you would need to record stock MOVEMENT not stock POSITION

    but this would mean that if you want to know the POSITION you would have to SUM() the MOVEMENTs for all time (or at least from the last known POSITION)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply