Forum Discussion

fabianfilth's avatar
fabianfilth
Regular Visitor
3 years ago
Solved

DateAdd

Hello power bi team,

 

Can you please give me some help on the following

 

I want to create a measure that calculates the total cost of the last day of the previous month of the previous year, but in the ENDOMONTH function more specifically in the DATEADD function, I get the error "A function DATEADD has been used in a True/False expression that is used as a table filter expression. This is not allowed".

How can I solve that?

 

thanks in advice

  • Hi fabianfilth 

    please try

    =
    CALCULATE (
    [Costo Total],
    'Dim Fecha'[Date] = EOMONTH ( 'Calidad Inventario'[Fecha Cargue], -12 ),
    ALL ( 'Dim Fecha' )
    )

2 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi fabianfilth 

    please try

    =
    CALCULATE (
    [Costo Total],
    'Dim Fecha'[Date] = EOMONTH ( 'Calidad Inventario'[Fecha Cargue], -12 ),
    ALL ( 'Dim Fecha' )
    )

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi fabianfilth 

    please try

    =
    CALCULATE (
    [Costo Total],
    'Dim Fecha'[Date] = EOMONTH ( 'Calidad Inventario'[Fecha Cargue], -12 ),
    ALL ( 'Dim Fecha' )
    )