Forum Discussion
Anonymous
8 years agoNot applicable
Day Count between two dates - DAX Help
I have seen a number of posts about calculating the day count between two date. None seem to address my specific use case. I am tring to calculate the day count between a "Creation Date" and "St...
- Anonymous8 years ago
Hi Anonymous,
If you can't ensure which date column with be the small one, you should add some operation to get the specificity one.
As I write above, min and max function can used to auto return the matched date.
I build a sample table with random date store in date1 and date2, then I can use above formula to get the diff between these date column.
Table formula:
Sample = ADDCOLUMNS(GENERATESERIES(1,100,1),"Date1",RANDBETWEEN(DATE(2015,1,1),TODAY()),"Date2",RANDBETWEEN(DATE(2015,1,1),TODAY()))
Calculate column:
Diff = DATEDIFF(MIN([Date1],[Date2]),MAX([Date1],[Date2]),DAY)
Reuslt:
Regards,
Xiaoxin Sheng
CanadaMGB
8 years agoFrequent Visitor
Would converting the dates to age in power query work for you? I've used the instructions from this post successfully
https://community.powerbi.com/t5/Desktop/Difference-between-two-dates-DAX/td-p/157320