Forum Discussion
peteru9067
Helper III
5 years agoDax Measures
I am trying to write a dax measures for finding the number of dates between two dates in column A & B....... I do not want to add a calculated column but a dax measures that will perform the differen...
- 5 years ago
You can try below code.
Date_Diff =var calculate_diff = DATEDIFF(MAX('Dates_table'[Column A]),MAX('Dates_table'[Column B]),DAY)return IF(calculate_diff < 0,calculate_diff * -1,calculate_diff) - 5 years ago
You can create measure with below code to achive this
Date_Differences =VAR calculate_diff =DATEDIFF ( MAX ( 'Test'[Column A] ), TODAY(), DAY )RETURNIF (MAX ( 'Test'[Column A] ) <= TODAY ()&& MAX ( 'Test'[Column B] ) = DATE ( 1899, 12, 31 ),calculate_diff,FORMAT ( MAX ( 'Test'[Column B] ), "MM/DD/YYYY" ))PFA screenshot of output
Samarth_18
Community Champion
5 years agoYou can try below code.
Date_Diff =
var calculate_diff = DATEDIFF(MAX('Dates_table'[Column A]),MAX('Dates_table'[Column B]),DAY)
return IF(calculate_diff < 0,calculate_diff * -1,calculate_diff)