value_format result is wrong

Looker Version:
2ec4ca93-7328-43f0-a90a-8cdfc209070f.png

## Context

10e83282-7d89-4c0a-a9c4-223acdf2fc68.png

value_format definition:  

1885bfd3-9d79-4ddb-8b8c-acda8712ca11.png

201 seconds to mm:ss should be 03:21.

3 * 60 + 21 = 201;

4af37059-168a-483c-8f23-4cb96209c000.png

But the looker displayed result is wrong:

26e37aa8-fc04-4d84-8e79-3ba164215e23.png


​​

The result is `03:20` , which is not right.

I create a Calculations:

287dc9f7-d1b3-4231-a9b3-fc475bfc9ab7.png

The Calculations are right:

b78a2eea-42b5-47e6-8003-a4fb79565b9f.png

Also Visualization is correct:

a8553e0a-7434-4139-9a09-2da49dc6f581.png

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?

0 2 190
2 REPLIES 2

I’m not able to reproduce this with AWS Redshift as connection and Looker version 22.10.32.

a6693b9b-bb02-433c-ab75-121bc1d33bdc.png


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}

30235e6c-b214-46cc-868c-292820e58973.png

${test.total_seconds_duration}, hh:mm:ss

88f34c42-bd63-4b2f-b6ef-243e296f266f.png

I’m not able to reproduce this with AWS Redshift as connection and Looker version 22.10.32.

a6693b9b-bb02-433c-ab75-121bc1d33bdc.png


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}

30235e6c-b214-46cc-868c-292820e58973.png

${test.total_seconds_duration}, hh:mm:ss

88f34c42-bd63-4b2f-b6ef-243e296f266f.png
Thank you very much for your reply, this problem may be because of different versions.
Top Labels in this Space
Top Solution Authors