Forum Discussion

ItSupportElm's avatar
ItSupportElm
Helper III
6 years ago
Solved

Power Query to DAX

Hello,   Im not confortable with DAX , someone can tell me how to translate this : " if Date.From([DateCreation]) > Date.From(Date.AddDays(DateTime.LocalNow(),-2)) then 0 else 1)" to DAX please ? i...
  • dax's avatar
    6 years ago

    Hi ItSupportElm,

    You could follow above suggestions. If you want to create calculated column, you could try below expression 

    Column = if('Table'[date]>TODAY()-2,0,1)

    If you want to use measure, you could try below expression

    Measure 2 = if(MIN('Table'[date])>TODAY()-2,0,1)

     

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • ItSupportElm's avatar
    6 years ago

    Thanks for the answer guys.

     

    dax i tried your expression but there is an error at the end :   ( i thought that was ";" but is not that neither)

     

    Same for a new colomn : 

     

    Thanks again for helping me

     

     

    I found out why it not work, 

     

    Column = IF('Alerte'[DateCreation]>TODAY()-2;"Inférieur à 48H";"Supérieur à 48H") we must seprate with ";" 
    Thanks again !