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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Month difference calculation

Hi,

 

  Please help me  to solve below logic.

 

if date1(Month) column greater than Date2(month) column  and having month difference as 2 month then return "2 month difference"

if date1(Month) column greater than Date2(month) column  and having month difference as 3 month then return "3 month difference"

 

Date1                  Date2                  Expected Calculated column

 

12/30/2019        10/25/2019             2 month difference   

12/30/2019        11/25/2019              1 month difference

12/30/2019         9/25/2019               3 month differnce 

 

 

Regards

Privya

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

datediff(date1,date2, MONTH)

 

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

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog -

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...


https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...

https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

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

2 REPLIES 2
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

I would suggest you to read the documentation on Datediff.

 

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

 

If you need to show only positive numbers, use them in IF statement.

 

Connect on LinkedIn
amitchandak
Super User
Super User

datediff(date1,date2, MONTH)

 

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

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog -

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...


https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...

https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.