superset icon indicating copy to clipboard operation
superset copied to clipboard

Date formating lost when selecting MAX(date)

Open guinny65 opened this issue 8 years ago • 7 comments

Make sure these boxes are checked before submitting your issue - thank you!

  • [x] I have checked the superset logs for python stacktraces and included it here as text if any
  • [x] I have reproduced the issue with at least the latest released version of superset
  • [x] I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.25.2

Expected results

Trying to display as a 'Big Number' the MAX value of a TIMESTAMP WITHOUT TIME ZONE date in a PostgresDB (V10).

Actual results

The date formating is lost. image

Steps to reproduce

Display the MAX of a time column from a PostgresDB.

Cheers!

guinny65 avatar May 15 '18 07:05 guinny65

@sbarlock What happens when you add an explicit type MAX(departure_date_time)::date or MAX(departure_date_time)::timestamp? This may be expected behavior based on the type being returned by the query.

aaronbannin avatar May 16 '18 03:05 aaronbannin

Hi @aaronbannin, Thanks for your answer.

Using MAX(departure_date_time)::DATE or MAX(departure_date_time)::TIMESTAMP does not change the behaviour.

The only difference is that MAX(departure_date_time)::DATE displays 1.51T instead of 1.51E.

Thanks.

guinny65 avatar May 16 '18 06:05 guinny65

What's happening here is that a date isn't really a metric. Big number assumes a number, not a date.

mistercrunch avatar May 22 '18 05:05 mistercrunch

@mistercrunch Thanks. So is there a way to display to a user, e.g. the last date a report was submitted?

guinny65 avatar May 22 '18 17:05 guinny65

For now I think you'll have to use a Table visualization.

In the future I'd like to have Markup visualization support templating so that you could fetch data from within that context.

## Days since last refresh
{{ fetch_sql_results("SELECT ...") }}

mistercrunch avatar May 23 '18 19:05 mistercrunch

Ok Thanks!

guinny65 avatar May 24 '18 05:05 guinny65

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

stale[bot] avatar Apr 10 '19 21:04 stale[bot]