Forum Discussion
Date difference between two columns in two tables
I'm trying to calculate the difference, i.e. the age between two date columns, in two different tables Without any luck...
Can someone assist??
6 Replies
- jdbuchanan71Super User
Hello Anonymous
Can you give us an idea of how the model is constructed? Are the tables joined together, what are the field names, etc? A sample of the data and an expected outcome (difference in months, days, years?) would also help.
- KayceVCHelper II
Have you tried using DATEDIFF in a calculated column?
Syntax: DATEDIFF(Table1[Start_Date], Table2[End-Date], interval)
This will throw an error if your end date is before your start date and your interval can be anything from a second to a year.
Reference: DATEDIFF Function
- AnonymousNot applicable
Hi Kayce
I have but I can't get the datediff function to see the second table.. Do I need to have the column names the same in the two tables?
I have a set of CSV files that I'm trying to trend over time. In the files is information about locked out users in AD and I have the AccountLock time stamp and what to correlate that value against the creation time stamp of the source file. I have a relationship between the two tables.
Excuse the dumb question but I'm new to this sort of data manipulation
- KayceVCHelper II
Did you import the csv files into your PowerBI report? Are you creating the DATEDIFF as a calculated column or a measure? Since this is iterating over rows, it has to be done as a calcualted column, a measure will not see all the fields in your tables. Also, double check your column formatting on the date columns. It should not matter, except to the resulting value, but it's something to check.