Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Metabase generates wrong dateformat for timedimension #68

Open
norbertbede opened this issue Apr 22, 2020 · 2 comments
Open

Metabase generates wrong dateformat for timedimension #68

norbertbede opened this issue Apr 22, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@norbertbede
Copy link

Describe the bug
Metabase 35.3 generates date range as the first ms from stardate and next period first ms.
IMHO time dimension and preaggregation rules are not applied properly.

{ "measures" : [ "Quotefacts.count" ], "dimensions" : [ "Quotefacts.salesrep" ], "timeDimensions" : [ { "dimension" : "Quotefacts.datequoted", "dateRange" : [ "2020-04-01T00:00:00+02:00", "2020-05-01T00:00:00+02:00" ] } ], "filters" : [ ], "order" : { "Quotefacts.count" : "desc", "Quotefacts.salesrep" : "asc" } }

Expected behavior
According to cubejs documentation ( updated to v 0.19.13) Metabase must follow the next rules:

Time dimension together with granularity constitute dimension. If date range isn't aligned with granularity common granularity is used. To match granularity date range should match it's start and end. For example for month it's ['2020-01-01T00:00:00.000', '2020-01-31T23:59:59.999'] and for day it's ['2020-01-01T00:00:00.000', '2020-01-01T23:59:59.999']. Date ranges are inclusive. Minimum granularity is second.

Version:
[v0.12.0]

@pyrooka pyrooka added the bug Something isn't working label Apr 22, 2020
@pyrooka
Copy link
Owner

pyrooka commented Apr 22, 2020

Valid. Some query generated by Metabase:
This month:
"dateRange": [ "2020-04-01T00:00:00Z", "2020-05-01T00:00:00Z" ]

between April 5, 2020 April 20, 2020
"dateRange": [ "2020-04-05T00:00:00Z", "2020-04-21T00:00:00Z" ]

@norbertbede
Copy link
Author

norbertbede commented Apr 25, 2020

Another issue: I got wrong end date-format and the next query.[v35.3 cubejs v.0.19.14]

{
  "measures" : [ "Logisticfacts.shipmentcount" ],
  "dimensions" : [ ],
  "timeDimensions" : [ {
    "dimension" : "Logisticfacts.shipdate",
    "granularity" : "week",
    "dateRange" : [ "2020-01-01T00:00:00Z", "2020-02-01T00:00:00Z" ]
  } ],
  "filters" : [ {
    "member" : "Logisticfacts.issotrx",
    "operator" : "equals",
    "values" : [ "true" ]
  }, {
    "member" : "Logisticfacts.c_docbasetype_name",
    "operator" : "equals",
    "values" : [ "Výdajka" ]
  }, {
    "member" : "Logisticfacts.isfreightplanned",
    "operator" : "equals",
    "values" : [ "true" ]
  }, {
    "member" : "Logisticfacts.driver_name",
    "operator" : "equals",
    "values" : [ "Adame" ]
  } ],
  "order" : {
    "Logisticfacts.shipdate" : "asc"
  }
}

expected behaviour
['2020-01-01T00:00:00.000', '2020-01-31T23:59:59.999']

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants