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
Anonymous
Not applicable

difference between Date (type: whole number. type: date) in measure

How to get the difference between release_year and date_added in measure

release_year datatype is the whole number.

date_added datatype is the date.

and we cant make changes in datatypes it's fixed.

so how we can convent and get the results.

 

thanks

 

o_khan_0-1625563065628.png

 

1 ACCEPTED SOLUTION

@Anonymous , if you need in month try like

 

datediff([date_added], date([release_year],1,1), month)

 

for measure, you need like

 

Sumx(Table, datediff([date_added], date([release_year],1,1), month))

 

or

Averagex(Table, datediff([date_added], date([release_year],1,1), month))

 

or

Can you share sample data and sample output in table format?

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

7 REPLIES 7
amitchandak
Super User
Super User

@Anonymous , Try new columns like

datediff([date_added], date([release_year],1,1), day) //or use month or year

 

or

 

datediff([date_added], date([release_year],12,31), day) //or use month or year

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
Anonymous
Not applicable

o_khan_0-1625564990024.png

o_khan_1-1625565186083.png

@amitchandak 

the numbers are not correct as expected.

November 13 2020 - 2019 = 23

12 months of 2019 and 11 months of = 22.1 something

 

need the difference in months and sec thing that should be created in measure, not in column measure

 

@Anonymous , if you need in month try like

 

datediff([date_added], date([release_year],1,1), month)

 

for measure, you need like

 

Sumx(Table, datediff([date_added], date([release_year],1,1), month))

 

or

Averagex(Table, datediff([date_added], date([release_year],1,1), month))

 

or

Can you share sample data and sample output in table format?

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
Anonymous
Not applicable

this works

Averagex(Table, datediff([date_added], date([release_year],1,1), month))

 

Thanks  @amitchandak 

Anonymous
Not applicable

thanks for feedbacks and point to the solution that works for your scenario, this will help others too 🙂

Anonymous
Not applicable

@Anonymous  what is the expected result? can you show us an example please.

Anonymous
Not applicable

november 13 2020 - 2019 = 23

 

12 months of 2019 and 11 months of = 22.1 something

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