Forum Discussion
Calculating difference between two date columns
Hi all,
I'm trying to calculate the difference between two date columns, however I'm running into some difficulty. The two columns, startdate and enddate, are coming from a Dim table, so if I try to create a measure using DATEDIFF it won't allow me to select from them, it will only allow me to select from other measures created. Is there a way around this?
I am unable to create a new calculated column as this data is coming straight from SSAS.
Thanks,
Aaron
Hi Anonymous ,
Based on your description, I have created a simple sample:
Please try:
Diff = DATEDIFF(MAX('Dim'[startdate]),MAX('Dim'[enddate]),DAY)Output:
Kind Regards,
Bubble
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- Greg_DecklerCommunity Champion
Anonymous Try something like MyDiff Measure = MAX('Table1'[EndDate]) - MAX('Table1'[StartDate]) * 1.
- Bubble4502Resolver III
Hi Anonymous ,
Based on your description, I have created a simple sample:
Please try:
Diff = DATEDIFF(MAX('Dim'[startdate]),MAX('Dim'[enddate]),DAY)Output:
Kind Regards,
Bubble
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
This worked! Thank you Bubble, much appreciated