Forum Discussion

RafaelAri's avatar
RafaelAri
Helper III
2 years ago

Set Measure value based on 2 tables

Hello experts,

I have 3 data tables: list of items (dim), inventory in warehouses (fact) and inventory transactions in warehouses (fact).
The 2 "fact" tables are linked in model to the "dim" table through "item number".
I need to set a measure that will display: (quantity in warehouses) / (summary of transactions in last 30 days).

Here are the measures I have now, bu results of Qty. WH/Trans. 30 days are not correct:

Trans. 30 days = CALCULATE(
                                SUM(fctStockTransactions[TransQty.]),
                                    FILTER(fctStockTransactions, DATEDIFF(fctStockTransactions[TransDate],TODAY(),DAY)<=30)
                                )

Qty. WH = SUM(fctWHINventory[WHQty.])

2 Replies

  • RafaelAri , Try with help from

     

    Rolling 30 = CALCULATE(Sum(fctStockTransactions[TransQty.]) ,DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-30,DAY))

     

    Rolling 30 = CALCULATE(Sum(fctStockTransactions[TransQty.]) , WINDOW(-29,REL, 0, REL, ADDCOLUMNS(ALLSELECTED('Date'[Date] ),ORDERBY([Date],asc)))

  • Thanks, I appreciate your help, but this is not what I need.
    I need a measure that gives me value for: (Sum[Qty.-in-Stock])/(Sum(Transactions[TransQty.] in last 30 days) for each Item-No.