Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Dax Column creation based on latest date

Hello, I am new to power bi and need some help. I am trying to create a column based on last login date. If the last login date is within a month ago, called active. If it is 2 months ago, called tw...
  • StefanoGrimaldi's avatar
    3 years ago

    hre the reference in the formula: 

    https://learn.microsoft.com/en-us/dax/datediff-function-dax

    try somehting like this: 

    Column = 

           IF( DATEDIFF ( StartDate, EndDate, MONTH ) <= 1 , "Active",

           IF( DATEDIFF ( StartDate, EndDate, MONTH ) <= 2, "2months ago",

           IF( DATEDIFF ( StartDate, EndDate, MONTH ) <= 3, "3months ago",

           IF( DATEDIFF ( StartDate, EndDate, MONTH ) < 12, "6months ago",

           IF( DATEDIFF ( StartDate, EndDate, MONTH ) >= 12, "Inactive")))))