Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Count Of Days In Month.

Hi ,

Date                     hire date

05-Aug-2020       05-aug-19

 

I need how many months diffrence Date and hire date,please help on this issues.

 

 

Regards,

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , as new column

datediff([hire date],today(),Month)

or

datediff([hire date],[date],Month)

 

as a new measure // you need to take care of row context

datediff(min([hire date]),today(),Month)

or

datediff(min([hire date]),Max([date]),Month)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , as new column

datediff([hire date],today(),Month)

or

datediff([hire date],[date],Month)

 

as a new measure // you need to take care of row context

datediff(min([hire date]),today(),Month)

or

datediff(min([hire date]),Max([date]),Month)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anand24
Super User
Super User

@Anonymous,

 

Create a new column and use the DATEDIFF function.

Here's a link to how DATEDIFF works: https://docs.microsoft.com/en-us/dax/datediff-function-dax

 

For months difference between Hire_Date and Date, you will have to use below formula:

Month_Diff Col = DATEDIFF([hire date], [Date], MONTH)

 

For days difference between Hire_Date and Date, you will have to use below formula:

 

Day_Diff Col = DATEDIFF([hire date], [Date], DAY)​

 

 

Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

az38
Community Champion
Community Champion

Hi @Anonymous 

try new column

Column = DATEDIFF([hire date], [Date], MONTH)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Maybe:

Column =
  VAR __HireYear = YEAR([hire date])
  VAR __HireMonth = MONTH([hire date])
  VAR __DateYear = YEAR([Date])
  VAR __DateMonth = MONTH([Date])
RETURN
  (__DateYear - __HireYear)*12 + (__HireMonth - __DateMonth)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors