Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |