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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
nvbuddy
Regular Visitor

Subtract minimum of a column from each value of a column

So I have a table with two columns: invention and year of its creation. I need a measure, which subtracts the minimum date from each date. If I'd create a new column named Diff, it would be Datediff = [disc_year] - MIN(table[disc_year]). But what if I don't want to create it and have a measure calculating in the same manner instead? Any tips?

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @nvbuddy 

Try this:

 Datediff =
Var _Min =calculate(Min(table[disc_year]),all(table))
Var _Mdate = Max(table[disc_year])
Return
_Mdate-_Min


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

Appreciate your Kudos!!



View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @nvbuddy 

Try this:

 Datediff =
Var _Min =calculate(Min(table[disc_year]),all(table))
Var _Mdate = Max(table[disc_year])
Return
_Mdate-_Min


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

Appreciate your Kudos!!



It works perfectly, thanks! If you don't mind, could you please clarify logic by steps? Why do we use max? And why we should use calculate with MIN, and not only MIN? I've searched for something like an iteration of subtraction for every row, but the logic in DAX differs from pandas in Python or sql (at least in code). Kinda new at Power BI😥

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.