Forum Discussion

amaniramahi's avatar
amaniramahi
Helper V
7 years ago
Solved

Average Stock days

Hi,   I have two tables, the first one contains SKUs and the order no. for each one. and the other table contains the order no. and receiving date for each order no.   I created a measure to cal...
  • v-lid-msft's avatar
    v-lid-msft
    6 years ago

    Hi amaniramahi ,

     

    Firstly you can use calculate column to calculate the days in stock for each order

     

    days in stock =
    DATEDIFF ( Receiving[Receive Date], TODAY (), DAY )

     

    Then we can use create this measure to meet your requirement.

     

    average-stock-days =
    AVERAGEX (
        Stock,
        LOOKUPVALUE ( Receiving[days in stock], Receiving[Order], [Order No.] )
    )

     

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ DongLi
    If this post helps, then please consider Accept it as the solution to help the other members find it more