Hanane AMGHAR Posted September 11, 2020 Share Posted September 11, 2020 Hello, I can't use timespan as a column response for my regression model. Is there any way to convert the type or change the format of the timespan column so it can work Link to comment Share on other sites More sharing options...
Fabian Duerr Posted September 11, 2020 Share Posted September 11, 2020 Go to 'insert' -> 'transformation' -> pick your data table and'change data type' from the drop down and click 'add'. Take your column and pick the desired data type. If your timespan column is a calculated column you could already make this transformation or make a copy of your timespan column with required data type: String([column]), Real([column])... Link to comment Share on other sites More sharing options...
Hanane AMGHAR Posted September 11, 2020 Author Share Posted September 11, 2020 Hello, thank you for your response. Yes my timespan is calculated and I tried to add Real([column]) but i have this weird result in the screen caps. Link to comment Share on other sites More sharing options...
Fabian Duerr Posted September 11, 2020 Share Posted September 11, 2020 What are the units of your time span Is the time span column really showing everything Can you give me an example how your timespan is calculated Maybe you can simply use the DateDiff function for your calculated column... Link to comment Share on other sites More sharing options...
Hanane AMGHAR Posted September 11, 2020 Author Share Posted September 11, 2020 This is how I calculated the timespan: DateDiff([CloseDate],[LossDate]). Thanks in advance Link to comment Share on other sites More sharing options...
Fabian Duerr Posted September 11, 2020 Share Posted September 11, 2020 So why do you need the time span function Can't you just use the DateDiff function and specify your units DateDiff('day',[CloseDate],[LossDate]) or DateDiff('hour',[CloseDate],[LossDate]) or .... The TimeSpan function will give you this format: d.h:m:s.ms (<-days.hours:minutes:seconds.ms). So 26.5 hours (= 1 day, 2 hours, 30 minutes) would be 1.2:30:00.0. The advantage is that you can easily read all units. If you need numeric values then you should not convert to TimeSpan Link to comment Share on other sites More sharing options...
Hanane AMGHAR Posted September 11, 2020 Author Share Posted September 11, 2020 Actually the problem is when I try to prepare my model I want to chose the variable that defines a time span between two dates as a colomn response but It doesn't appear as an option . Link to comment Share on other sites More sharing options...
Hanane AMGHAR Posted September 11, 2020 Author Share Posted September 11, 2020 Actually the problem is when I try to prepare my model I want to chose the variable that defines a time span between two dates as a colomn response but It doesn't appear as an option . Link to comment Share on other sites More sharing options...
Fabian Duerr Posted September 12, 2020 Share Posted September 12, 2020 The response column has to be numerice. Please you DateDiff instead of TimeSpan and your column should show up. Link to comment Share on other sites More sharing options...
Hanane AMGHAR Posted September 12, 2020 Author Share Posted September 12, 2020 Hello, thank you for your response, That's what I did but it still doesn't show up. Link to comment Share on other sites More sharing options...
Fabian Duerr Posted September 12, 2020 Share Posted September 12, 2020 No, that's not what you did... You only changed the formatting of the column. The date type is still TimeSpan. Please specifiy your units in the DateDiff function and the data type will be a real. See my answer from yesterday: So why do you need the time span function Can't you just use the DateDiff function and specify your units DateDiff('day',[CloseDate],[LossDate]) or DateDiff('hour',[CloseDate],[LossDate]) or .... Link to comment Share on other sites More sharing options...
Hanane AMGHAR Posted September 12, 2020 Author Share Posted September 12, 2020 My bad, I just payed attention to that. Thank you it worked. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now