Forum Discussion

AdamPowerBI2024's avatar
2 years ago
Solved

Latest finished product and corresponding quantity

Hi, I want to create a last estimate of a produced item (so the latest finished product). I get it correctly with the below Dax formula: Last Estimate Order = VAR Last_estimate = MAXX(FILTER(AL...
  • AdamPowerBI2024's avatar
    2 years ago

    Hi,

    I think I've got it. Thank a lot for your help.

     

    Last Order Quantity in Month (per Product Type) = 
    VAR Last_estimate = MAXX(FILTER(ALLSELECTED(ProductionCalculations), ProductionCalculations[EndedDate.EndedDate]=MAX(ProductionCalculations[EndedDate.EndedDate])), ProductionCalculations[FinishedDate.Finished Date])

    RETURN
    CALCULATE(SUM(ProductionCalculations[Real consump Qty (kg)]),
    FILTER((ProductionCalculations),ProductionCalculations[FinishedDate.Finished Date]= Last_estimate
        &&ProductionCalculations[Productions.Prod Id] = CALCULATE(MAX ( ProductionCalculations[Productions.Prod Id] ),
                            FILTER ( ProductionCalculations,ProductionCalculations[FinishedDate.Finished Date] = Last_estimate))))