Looker Version:
## Context
value_format definition:
201 seconds
to mm:ss
should be 03:21.
3 * 60 + 21 = 201;
But the looker displayed result is wrong:
The result is `03:20` , which is not right.
I create a Calculations:
The Calculations are right:
Also Visualization is correct:
Code:
```
view: demo {
derived_table: {
sql: select 201 as seconds ;;
}
dimension: seconds_duration {
type: number
sql: ${TABLE}.seconds ;;
}
measure: total_seconds_duration {
label: "Total seconds Duration"
type: number
sql: ${seconds_duration} / cast(86400 as real);;
value_format: "[hh]:mm:ss"
}
}
```
Since the data needs to be displayed in a bar chart on the dashboard, if it is changed to manual calculation, it will become a string and the height on the bar chart is wrong.
So Can you please take a look or have a good solution?
I’m not able to reproduce this with AWS Redshift as connection and Looker version 22.10.32.
LookML code is exactly as yours
view: test {
derived_table: {
sql: SELECT 201 AS seconds ;;
}
dimension: seconds_duration {
type: number
sql: ${TABLE}.seconds ;;
}
measure: total_seconds_duration {
label: "Total seconds duration"
type: number
sql: ${seconds_duration} / cast(86400 AS real) ;;
value_format: "[hh]:mm:ss"
}
}
Table calculations
${test.total_seconds_duration}
${test.total_seconds_duration}, hh:mm:ss
I’m not able to reproduce this with AWS Redshift as connection and Looker version 22.10.32.
LookML code is exactly as yours
view: test {
derived_table: {
sql: SELECT 201 AS seconds ;;
}
dimension: seconds_duration {
type: number
sql: ${TABLE}.seconds ;;
}
measure: total_seconds_duration {
label: "Total seconds duration"
type: number
sql: ${seconds_duration} / cast(86400 AS real) ;;
value_format: "[hh]:mm:ss"
}
}
Table calculations
${test.total_seconds_duration}
${test.total_seconds_duration}, hh:mm:ss
Thank you very much for your reply, this problem may be because of different versions.