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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculate for specific Years in DAX

I need to calculate the number of days in a specific year without referencing another table. I am calculating for the years: 2017, 2018, 2019, & 2020. 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Anonymous 

These should get you there.

Days 2017 = DATEDIFF ( DATE ( 2017, 1, 1), DATE ( 2017, 12, 31), DAY )
Days 2018 = DATEDIFF ( DATE ( 2018, 1, 1), DATE ( 2018, 12, 31), DAY )
Days 2019 = DATEDIFF ( DATE ( 2019, 1, 1), DATE ( 2019, 12, 31), DAY )
Days 2020 = DATEDIFF ( DATE ( 2020, 1, 1), DATE ( 2020, 12, 31), DAY )

 

View solution in original post

1 REPLY 1
jdbuchanan71
Super User
Super User

Hello @Anonymous 

These should get you there.

Days 2017 = DATEDIFF ( DATE ( 2017, 1, 1), DATE ( 2017, 12, 31), DAY )
Days 2018 = DATEDIFF ( DATE ( 2018, 1, 1), DATE ( 2018, 12, 31), DAY )
Days 2019 = DATEDIFF ( DATE ( 2019, 1, 1), DATE ( 2019, 12, 31), DAY )
Days 2020 = DATEDIFF ( DATE ( 2020, 1, 1), DATE ( 2020, 12, 31), DAY )

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors