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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Zarlot531
Helper V
Helper V

DAX formula for Calendar month difference between two dates ?

So I know there are complicated ways to do this, but I was wondering what the simplest way would be to the following types of differences between dates:

 

Some examples: 

 

1/31/2019 - 2/1/2019 = 1 

1/25/2019 - 1/26/2019 = 0

3/1/2019 - 4/30/2019 = 1 

3/1/2019 - 5/1/2019 = 2 

 

In other words, it's built off the month rather than the days. Datediff doesn't seem to be consistent here... 

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@Zarlot531 ,

 

You can simply create a calculate column using dax as below:

Monthdiff = DATEDIFF(Query1[SoldMonth], Query1[EndMonth], MONTH)

Capture.PNG  

 

You can also refer to the pbix file.

 

Community Support Team _ Jimmy Tao

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

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@Zarlot531 ,

 

You can simply create a calculate column using dax as below:

Monthdiff = DATEDIFF(Query1[SoldMonth], Query1[EndMonth], MONTH)

Capture.PNG  

 

You can also refer to the pbix file.

 

Community Support Team _ Jimmy Tao

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

Zarlot531
Helper V
Helper V

by the way, why are my datediff formulas not able to see the date fields? 

 

Capture333.JPG

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.