Forum Discussion
Calculate time between two date column in different tables
Hello,
I'm trying to calculate the time between two date columns that are in different tables
This is what i got so far:
For example the time differens in the first record should juist a bit longer than 3 days and not -201,63
I also tried:
_AN_Houdbaarheid = DATEDIFF(RELATED(AQZ_SAMP_VIEW[MO_Bemonsteringsdatum].[Date]);'AQZ_TEST_VIEW'[AN_start_Datum].[Date];DAY)
But the same probleem. Hopefully someone can help my
Hi icturion ,
By my tests, if you want to calculate the difference between the date from different table, you formula should be right.
I have a little confused about your scenario, for your first record, the difference between 2016-7-28 11:45:00 and 2016-1-8 20:31:00 should be 202 if you calculate for Days.
Why do you think that time differens in the first record should juist a bit longer than 3 days?
Did I misunderstand your data sample?
What is your desired output? And which difference do you want to calculate between the two date column? Day, Month or Minute?
Best Regards,
Cherry
4 Replies
- TomMartensSuper User
Hey,
I guess the date is not recognized properly, just check using the month function, if you receive July or August and not error and January.
Do not use .Day, just the column reference.
Regards,
Tom
- icturionResolver II
Hi Tom,
If I use month with datediff the i get an error.
both columns are type: date and time
Regards
- icturionResolver II
Hi Tom,
If i use:
Month check = AQZ_TEST_VIEW[AN_Start_Datum].[Month]
and
Month check = AQZ_SAMP_VIEW[MO_bemonsteringdatum].[Month]
I get the correct month on bove columns.
but still the time differents is incorrect
- v-piga-msftResident Rockstar
Hi icturion ,
By my tests, if you want to calculate the difference between the date from different table, you formula should be right.
I have a little confused about your scenario, for your first record, the difference between 2016-7-28 11:45:00 and 2016-1-8 20:31:00 should be 202 if you calculate for Days.
Why do you think that time differens in the first record should juist a bit longer than 3 days?
Did I misunderstand your data sample?
What is your desired output? And which difference do you want to calculate between the two date column? Day, Month or Minute?
Best Regards,
Cherry