Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mrainey18
Creator
Creator

Linest_R2

LINEST_R2(

      aggr(avg(Hours),CalendarDate),CalendarDate

)

I am trying to calculate R but the number I am getting is really low.  Is there a way to increase the forgiveness of R.

I'm not talking about taking the square root of it.  Maybe rounding the average to the nearest integer?

7 Replies
sunny_talwar

For rounding you can do this....? But I am not sure if this is exactly what is needed here or not

LINEST_R2(

      aggr(Round(avg(Hours)),CalendarDate),CalendarDate

)

mrainey18
Creator
Creator
Author

I'm trying to measure the consistency of hours per day over a selected period using R.

Example: I have 7 days selected. 8.49, 8.39, 8.46, 8.24, 8.44, 8.13, 8.20, 8.15

R2 =  .62

I want that to read 1 or very close to 1 because they are all very close to each other.  I'm not sure why.

My next idea is to force a y intercept as the average Hours but I'm having trouble with the expression.

sunny_talwar

May be RoundUp or RoundDown using Ceil or Floor?

LINEST_R2(

      aggr(Ceil(avg(Hours)),CalendarDate),CalendarDate

)

or

LINEST_R2(

      aggr(Floor(avg(Hours)),CalendarDate),CalendarDate

)

mrainey18
Creator
Creator
Author

Update: Hours is a variable that is calculating the difference of a clock in to a clock out number.

LINEST_R2(

      aggr((avg($(vHours))),CalendarDate),CalendarDate

)

When I added Floor it did not return anything.

LINEST_R2(

      aggr(Floor(avg($(vHours))),CalendarDate),CalendarDate

)

sunny_talwar

What about when you used Round or Ceil? It works for these guys?

mrainey18
Creator
Creator
Author

No.  None of them work. 

I even tried adding Floor to my variable but I'm still getting a - in the table.

sunny_talwar

Not sure