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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mdaamirkhan
Post Prodigy
Post Prodigy

How to calculate Number of month for in current year and Number of month for in current year+1

Hi All,

 

I need help in dax to calculate the below 3 steps as I already mention Date below as I have Year from 2019 to 2023

 

1. Number of months

2. Number of month for in current year 
3.Number of month for in current year+1 

 

Date
1/12/2019
3/12/2020
3/1/2021
3/2/2021
3/3/2021
3/4/2021
1/12/2022
2/12/2022
3/1/2023
3/2/2023
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mdaamirkhan , Try a new

Best Create a new column

Month Year sort = FORMAT([Date],"yyyymm")

 

And they try a new measure like

Number of months= calculate(distinctCOUNT(Table[month year]))

Number of month for in current year= calculate(distinctCOUNT(Table[month year]), filter( Table, Year(Table[Date]) = year(Today())))

Number of month for in current year + 1= calculate(distinctCOUNT(Table[month year]), filter( Table, Year(Table[Date]) = year(Today())+1))

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
mdaamirkhan
Post Prodigy
Post Prodigy

I forget to mention this one as well
Number of month for which contract is active since today
example we date and Active column where there in Yes and NO. How will I calculate

mdaamirkhan
Post Prodigy
Post Prodigy

Thanks it works and I forget to mention this one as well

Number of month for which contract is active since today

example we date and Active column where there in Yes and NO. How will I calculate

Any idea on this Number of month for which contract is active since today
example we date and Active column where there in Yes and NO. How will I calculate

amitchandak
Super User
Super User

@mdaamirkhan , Try a new

Best Create a new column

Month Year sort = FORMAT([Date],"yyyymm")

 

And they try a new measure like

Number of months= calculate(distinctCOUNT(Table[month year]))

Number of month for in current year= calculate(distinctCOUNT(Table[month year]), filter( Table, Year(Table[Date]) = year(Today())))

Number of month for in current year + 1= calculate(distinctCOUNT(Table[month year]), filter( Table, Year(Table[Date]) = year(Today())+1))

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors