Forum Discussion

oveloz's avatar
oveloz
New Member
5 years ago
Solved

Need help with Dax πŸ†˜πŸ™πŸ»

Hi guys, for days I have been trying to recreate a formula in Excel with Dax but I have not had any luck The formula is a Vlookup inside an iferror that shows me the date of the last meal when the L...
  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    With this model

    and this measure 

     

    Previous date for Lote =
    VAR Lote =
        MAX ( 'Dim Lote'[Lote] )
    VAR CalcDate =
        MAXX (
            FILTER (
                ALL ( 'Table' ),
                'Table'[Fecha Comida] < MAX ( 'Table'[Fecha Comida] )
                    && 'Table'[Lote] = Lote
            ),
            'Table'[Fecha Comida]
        )
    RETURN
        CALCULATE (
            MAX ( 'Calendar Table'[Date] ),
            FILTER ( ALL ( 'Calendar Table' ), 'Calendar Table'[Date] = CalcDate )
        )
    

     

     

    You will get

     

    I've attached the sample PBIX file