Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 two months ago etc.
Here is my dax but it’s showing the wrong result except for "Active".
Column =
IF( MONTH(TODAY())-1 <= MONTH((DATEADD(Employee[Last Login],-1,MONTH))), "Active",
IF( MONTH(TODAY())-2 <= MONTH((DATEADD(Employee[Last Login],-2,MONTH))), "2months ago",
IF( MONTH(TODAY())-3 <= MONTH((DATEADD(Employee[Last Login],-3,MONTH))), "3months ago",
IF( MONTH(TODAY())-6 <= MONTH((DATEADD(Employee[Last Login],-6,MONTH))), "6months ago",
IF( MONTH(TODAY())-12 <= MONTH((DATEADD(Employee[Last Login],-12,MONTH))), "Inactive")))))
Solved! Go to Solution.
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")))))
Proud to be a Super User!
Thank you so much💖
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")))))
Proud to be a Super User!