Forum Discussion

rachaelwalker's avatar
rachaelwalker
Icon for Resolver III rankResolver III
2 years ago
Solved

Find Last Value by MAX date and SUM

I have an inventory audit table. I created a measure to find the qty of the last record date for each warehouse and bin, however the grand total is showing 0 but I want it to SUM that measure. For the example below, I want the grand total to show 37.

Qty Last Value = CALCULATE(SELECTEDVALUE('Inventory Audit By Date'[Qty On Hand]), 'Inventory Audit By Date'[Date] = MAX('Inventory Audit By Date'[Date]))

 

 

*Date Max is also a measure

Date MAX = MAX('Inventory Audit By Date'[Date])

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Thanks for the reply from tamerj1 and Greg_Deckler.

     

    Hi rachaelwalker ,

     

    Based on your description, I created a simple example data and rewrote your measure to achieve the desired result.

    Here are my steps:

     

    1.Create a simple data:

     

    2.Create a measure, use SUMX to calculate total.

    Qty Last Value = 
    SUMX(
        SUMMARIZE(
            'Table',
            'Table'[Warehouse],
            'Table'[WarehouseBin],
            "Lastvalue", CALCULATE(SELECTEDVALUE('Table'[QtyOnHand]), 'Table'[Date]= MAX('Table'[Date]))
        ),
        [Lastvalue]
    )

     

    3.The final result is as follows:

     

    Best Regards,
    Zhu
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

3 Replies