The default date of the date filter

Set the default date of the date filter to be the today, not the current date of the user.

My current time here is 00:30:00 on April 16, 2019, and the default date of the date filter is the data of April 15th.

What’s the timezones of the server/container, database, reporting and the user?


Is the filter’s default date obtained in the US time zone?

“Current: Day” aka “Today”, which is used in Field Filters, sends the value thisday to Metabase, which is converted into a query and send to the database.

So that comes down to which database you use. You can check what query is actually being created by looking in the browser console under Network-tab, where you will see POST-requests to Metabase and you can click those requests to see details in the Response-tab.

Your problem is most likely that your database is using GMT+0 aka UTC aka Zulu as timezone.

The filter is some date, but the result is another.

Our database is SQL Server and Metabase DB is MySql.

The problem is on the SQL Server or Metabase DB?
In the minor version (0.33) was working, but in the current version doesn’t work.

@AdrianoSM
Please post “Diagnostic Info” from Admin > Troubleshooting.
Looks like it’s a timezone problem. Have a look at the troubleshooting guide:
https://www.metabase.com/docs/latest/troubleshooting-guide/timezones.html


{
“browser-info”: {
“language”: “pt-BR”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36”,
“vendor”: “Google Inc.”
},
“system-info”: {
“file.encoding”: “UTF-8”,
“java.runtime.name”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.5+10”,
“java.vendor”: “AdoptOpenJDK”,
“java.vendor.url”: “https://adoptopenjdk.net/”,
“java.version”: “11.0.5”,
“java.vm.name”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.5+10”,
“os.name”: “Linux”,
“os.version”: “4.4.0-128-generic”,
“user.language”: “en”,
“user.timezone”: “America/Sao_Paulo”
},
“metabase-info”: {
“databases”: [
“googleanalytics”,
“sqlserver”
],
“hosting-env”: “unknown”,
“application-database”: “postgres”,
“application-database-details”: {
“database”: {
“name”: “PostgreSQL”,
“version”: “12.1”
},
“jdbc-driver”: {
“name”: “PostgreSQL JDBC Driver”,
“version”: “42.2.8”
}
},
“run-mode”: “prod”,
“version”: {
“date”: “2020-04-02”,
“tag”: “v0.35.1”,
“branch”: “release-0.35.x”,
“hash”: “e67f169”
},
“settings”: {
“report-timezone”: “America/Sao_Paulo”
}
}
}

@AdrianoSM You’re saying that you’re having problems with SQL Server, but the first screenshot looks to be Postgres…?
I have a feeling that your SQL Server is using UTC. If you change Admin > Settings > General > Report Timezone to “Database default” or “UTC”, does that make the data show correctly?
You might be seeing this issue, but we don’t have enough information to reproduce the problem:
https://github.com/metabase/metabase/issues/11599

Flamber.

Our Databases are SQL Server.
Only Metabase are allocated on Linux with Postgres/MySQL.
The first print that i sent just show the time.
I tried to change to UTC, GMT, Brasil/East but whithout sucess.

Getting the machine timezone, i executed:

DECLARE @TimeZone VARCHAR(50)
EXEC MASTER.dbo.xp_regread ‘HKEY_LOCAL_MACHINE’,‘SYSTEM\CurrentControlSet\Control\TimeZoneInformation’,‘TimeZoneKeyName’,@TimeZone OUT
SELECT @TimeZone

The result was: E. South America Standard Time

select SYSDATETIMEOFFSET()
2020-04-08 15:46:31.5039120 -03:00

Machine time/Hour
image

The question, based on the database schema, in notebook.

Date Filter

Looking at the SQL Profile, and the report, we found this:

We change the question, converting to SQL Query and specify the parameter to the same type used before (Data Filter):



image

The results is correct (look at query trace):

Why in the questions based on the database schema, in notebook we still with problem?

Tks in advance!

@AdrianoSM

I don’t understand the problem anymore.

The screenshot in your first post says abril 6, 2020 in the filter, but the results are abril 7, 2020.

But now you’re saying the when using Native questions it’s correct, but using Query Browser it’s incorrect? That contradicts your first post.

All queries has to executed from Metabase - otherwise you might get different timezone results.
So did you run select SYSDATETIMEOFFSET() from Metabase?

What is the column type of dt_pedido?
What is the Field Type of the same column? Admin > Data Model > (database) > (table) > (column) :gear:

It would be very helpful if you can create a sample schema, so we can reproduce the problem.

Hi @flamber.
That is it. We had the same problem when was update from version 0.33 to 0.34. We had to make downgrade and now we have the same problem again.

The first print show the problem. We apply abril 6, 2020in the filter, but the results areabril 7, 2020`

I sent all the results and prints about the machine and database timezone configuration.
Yes, the problem occours when use query browser, but not with native query.

Follow the schemas:

If you need i can sent to you a sql server script with the table and some records.

Tks!

@AdrianoSM

It is important to report problems - otherwise it will never get fixed.

I’m guessing that the results are not actually from “abril 7, 2020” - it’s just displayed like that. If you check the actual result set returned to the browser, then all results are likely “abril 6, 2020”.

If dt_pedido has a Field Type as “Foreign Key”, then that’s of course incorrect and should be changed to “Creation datetime” for example.
Metabase will try to guess the Field Type, when it synchronizes first time, but that’s not always correct and need to manually adjusted:
https://www.metabase.com/docs/latest/administration-guide/03-metadata-editing.html

I don’t think you understand, when I’m asking for a sample schema. I’m asking for you to provide sample code (table including some data), so I can create a table and see the exact same problem on my test setup.

Sorry @flamber.

I sent all the information checked to help to understand. The results displayed in the browser are incorrectly.

The Filter is “abril 6, 2020” and the results are “abril 7, 2020”. I get the same, executing the trace captured from execution.

I’m sending the script with table schema with data between abril 5, 2020 and abril 8, 2020 and the trace logged from the Metabase query execution:


sample schema:

CREATE TABLE [dbo].[Fat_pedidos](
[id_pedido] [int] NOT NULL,
[id_loja] [int] NULL,
[id_plataforma] [int] NULL,
[id_cliente_endereco] [int] NULL,
[id_cliente] [int] NULL,
[dt_pedido] [datetime] NULL,
[dt_entrega_inicio] [datetime] NULL,
[valor_pedido] [numeric](12, 2) NULL,
[online] [bit] NULL,
[entrega] varchar NULL,
[forma_pgto] varchar NULL,
[pesquisa_avaliacao] [numeric](13, 1) NULL,
[status] varchar NULL,
[Pgto_Online_Canal] varchar NULL,
[cod_pedido] varchar NULL,
[cod_pedido_loja] varchar NULL,
[cupom_codigo] varchar NULL,
[cupom_desconto] [numeric](13, 2) NULL,
[cupom_patrocinado] [bit] NULL,
[canal] varchar NULL,
[origem_midia] varchar NULL,
[dispositivo] char NULL,
[UltimaCompra] varchar NULL,
[QtddPedidosNaLoja] [int] NULL,
[QtddItens] [smallint] NULL,
[id_cancelamento_motivo] [smallint] NULL,
[vlr_desconto] [decimal](12, 2) NULL,
[TemColetor] varchar NULL,
[SKUsEmRuptura] [smallint] NULL,
[SKUsEmDesistencia] [smallint] NULL,
[Houve_Ruptura] char NULL,
[Qtdd] [int] NULL
) ON [PRIMARY]
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830091, 2789, 3, 1434718, 1482382, CAST(N’2020-04-05T00:00:00.000’ AS DateTime), CAST(N’2020-04-05T10:04:22.893’ AS DateTime), CAST(119.94 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-A1830091’, N’1830091’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 2, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830121, 2789, 3, 1626115, 1653311, CAST(N’2020-04-05T00:00:00.000’ AS DateTime), CAST(N’2020-04-05T10:07:31.893’ AS DateTime), CAST(44.09 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-A1830121’, N’1830121’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830167, 2789, 3, 1477899, 1521105, CAST(N’2020-04-05T00:00:00.000’ AS DateTime), CAST(N’2020-04-05T10:16:31.000’ AS DateTime), CAST(85.44 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-A1830167’, N’1830167’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Não’, NULL, 4, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830468, 2789, 3, 1628540, 1655536, CAST(N’2020-04-05T00:00:00.000’ AS DateTime), CAST(N’2020-04-05T10:37:10.907’ AS DateTime), CAST(164.62 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-A1830468’, N’1830468’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 7, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830526, 2789, 3, 1590185, 1621127, CAST(N’2020-04-05T00:00:00.000’ AS DateTime), CAST(N’2020-04-05T10:41:12.120’ AS DateTime), CAST(107.36 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-A1830526’, N’1830526’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Não’, NULL, 9, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 1, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830541, 2789, 3, 971906, 1060175, CAST(N’2020-04-05T00:00:00.000’ AS DateTime), CAST(N’2020-04-05T10:41:45.830’ AS DateTime), CAST(28.29 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-A1830541’, N’1830541’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Não’, NULL, 4, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830549, 2789, 3, 946327, 762493, CAST(N’2020-04-05T00:00:00.000’ AS DateTime), CAST(N’2020-04-05T10:42:42.547’ AS DateTime), CAST(50.55 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’CAN’, N’–’, N’2789-A1830549’, N’1830549’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 3, 19, CAST(0.00 AS Decimal(12, 2)), N’Sem coletor’, 3, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843060, 2789, 3, 1639503, 1665384, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T10:22:27.980’ AS DateTime), CAST(44.09 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-B1843060’, N’1843060’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843217, 2789, 3, 1639614, 1665486, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T10:18:26.423’ AS DateTime), CAST(146.20 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-B1843217’, N’1843217’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843244, 2789, 3, 1506942, 1547248, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T10:19:23.507’ AS DateTime), CAST(84.67 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-B1843244’, N’1843244’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Não’, NULL, 3, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843247, 2789, 3, 1639634, 1665502, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T10:19:24.903’ AS DateTime), CAST(58.27 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-B1843247’, N’1843247’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 6, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 2, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843548, 2789, 3, 840474, 937561, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T10:31:45.063’ AS DateTime), CAST(7.50 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’CAN’, N’–’, N’2789-B1843548’, N’1843548’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 2, 19, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 1, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843553, 2789, 3, 1528953, 1566711, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T10:31:49.733’ AS DateTime), CAST(88.90 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-B1843553’, N’1843553’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 5, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 1, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843783, 2789, 3, 1640040, 1665839, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T10:41:21.450’ AS DateTime), CAST(39.89 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’CAN’, N’–’, N’2789-B1843783’, N’1843783’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 3, 19, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 1, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1864778, 2789, 3, 1418340, 1467664, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T20:40:14.517’ AS DateTime), CAST(92.86 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-B1864778’, N’1864778’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Não’, NULL, 8, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1865220, 2789, 3, 1651535, 1676011, CAST(N’2020-04-06T00:00:00.000’ AS DateTime), CAST(N’2020-04-06T21:07:38.157’ AS DateTime), CAST(80.28 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-B1865220’, N’1865220’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 4, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868223, 2789, 3, 1659571, 1683183, CAST(N’2020-04-07T00:00:00.000’ AS DateTime), CAST(N’2020-04-07T09:17:42.363’ AS DateTime), CAST(69.94 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’CAN’, N’–’, N’2789-C1868223’, N’1868223’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 2, 19, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 1, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868254, 2789, 3, 1137955, 1211746, CAST(N’2020-04-07T00:00:00.000’ AS DateTime), CAST(N’2020-04-07T09:18:41.290’ AS DateTime), CAST(26.95 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-C1868254’, N’1868254’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Não’, NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868291, 2789, 3, 1659616, 1683222, CAST(N’2020-04-07T00:00:00.000’ AS DateTime), CAST(N’2020-04-07T09:20:34.827’ AS DateTime), CAST(110.04 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-C1868291’, N’1868291’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 8, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 1, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868371, 2789, 3, 1439066, 1462627, CAST(N’2020-04-07T00:00:00.000’ AS DateTime), CAST(N’2020-04-07T10:13:39.487’ AS DateTime), CAST(89.90 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-C1868371’, N’1868371’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868413, 2789, 3, 850031, 946436, CAST(N’2020-04-07T00:00:00.000’ AS DateTime), CAST(N’2020-04-07T10:15:07.213’ AS DateTime), CAST(73.78 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-C1868413’, N’1868413’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 5, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868507, 2789, 3, 851056, 947402, CAST(N’2020-04-07T00:00:00.000’ AS DateTime), CAST(N’2020-04-07T10:20:28.183’ AS DateTime), CAST(66.41 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-C1868507’, N’1868507’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Não’, NULL, 3, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921314, 2789, 3, 624526, 736151, CAST(N’2020-04-08T00:00:00.000’ AS DateTime), CAST(N’2020-04-08T21:17:18.550’ AS DateTime), CAST(159.92 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-D1921314’, N’1921314’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 3, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 1, 0, N’Sim’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921545, 2789, 3, 1699189, 1718311, CAST(N’2020-04-08T00:00:00.000’ AS DateTime), CAST(N’2020-04-08T21:38:14.340’ AS DateTime), CAST(45.95 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Visa Crédito Online’, NULL, N’FIN’, N’–’, N’2789-D1921545’, N’1921545’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921552, 2789, 3, 1454795, 1500423, CAST(N’2020-04-08T00:00:00.000’ AS DateTime), CAST(N’2020-04-08T21:38:56.297’ AS DateTime), CAST(51.90 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’FIN’, N’–’, N’2789-D1921552’, N’1921552’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N’Com coletor’, 0, 0, N’Nao’, 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921618, 2789, 3, 1699274, 1718393, CAST(N’2020-04-08T00:00:00.000’ AS DateTime), CAST(N’2020-04-08T21:46:01.127’ AS DateTime), CAST(29.95 AS Numeric(12, 2)), 0, N’ENTREGA’, N’Mastercard Crédito Online’, NULL, N’CAN’, N’–’, N’2789-D1921618’, N’1921618’, NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N’–’, N’–’, NULL, N’Sim’, NULL, 1, 18, CAST(0.00 AS Decimal(12, 2)), N’Sem coletor’, 0, 0, N’Nao’, 1)
GO


Query trace logged:

exec sp_executesql N’-- Metabase:: userID: 74 queryType: MBQL queryHash: 3a92225f50c6b8c6912dcffd2a3d49cacf92f22a61fdf7204f47a601b9fe14fd
SELECT TOP 2000 *
FROM “dbo”.“FAT_Pedidos”
WHERE (“dbo”.“FAT_Pedidos”.“dt_pedido” >= @P0 AND “dbo”.“FAT_Pedidos”.“dt_pedido” < @P1) ‘,
N’@P0 datetimeoffset,@P1 datetimeoffset’,‘2020-04-06 00:00:00 -03:00’,‘2020-04-07 00:00:00 -03:00’

@AdrianoSM It seems like the forum is doing something wrong to the SQL. Can you attach it as a file or enclose it with code tags (click the </> icon in the forum editor)?

Here is the Query Traced

exec sp_executesql N'-- Metabase:: userID: 74 queryType: MBQL queryHash: 3a92225f50c6b8c6912dcffd2a3d49cacf92f22a61fdf7204f47a601b9fe14fd
SELECT TOP 2000 * 
FROM "dbo"."FAT_Pedidos" 
WHERE ("dbo"."FAT_Pedidos"."dt_pedido" >= @P0 AND "dbo"."FAT_Pedidos"."dt_pedido" < @P1) ',
N'@P0 datetimeoffset,@P1 datetimeoffset','2020-04-06 00:00:00 -03:00','2020-04-07 00:00:00 -03:00'

And here is the Query Schema:

CREATE TABLE [dbo].[Fat_pedidos](
	[id_pedido] [int] NOT NULL,
	[id_loja] [int] NULL,
	[id_plataforma] [int] NULL,
	[id_cliente_endereco] [int] NULL,
	[id_cliente] [int] NULL,
	[dt_pedido] [datetime] NULL,
	[dt_entrega_inicio] [datetime] NULL,
	[valor_pedido] [numeric](12, 2) NULL,
	[online] [bit] NULL,
	[entrega] [varchar](8) NULL,
	[forma_pgto] [varchar](100) NULL,
	[pesquisa_avaliacao] [numeric](13, 1) NULL,
	[status] [varchar](3) NULL,
	[Pgto_Online_Canal] [varchar](255) NULL,
	[cod_pedido] [varchar](20) NULL,
	[cod_pedido_loja] [varchar](25) NULL,
	[cupom_codigo] [varchar](25) NULL,
	[cupom_desconto] [numeric](13, 2) NULL,
	[cupom_patrocinado] [bit] NULL,
	[canal] [varchar](255) NULL,
	[origem_midia] [varchar](255) NULL,
	[dispositivo] [char](3) NULL,
	[UltimaCompra] [varchar](10) NULL,
	[QtddPedidosNaLoja] [int] NULL,
	[QtddItens] [smallint] NULL,
	[id_cancelamento_motivo] [smallint] NULL,
	[vlr_desconto] [decimal](12, 2) NULL,
	[TemColetor] [varchar](12) NULL,
	[SKUsEmRuptura] [smallint] NULL,
	[SKUsEmDesistencia] [smallint] NULL,
	[Houve_Ruptura] [char](3) NULL,
	[Qtdd] [int] NULL
) ON [PRIMARY]
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830091, 2789, 3, 1434718, 1482382, CAST(N'2020-04-05T00:00:00.000' AS DateTime), CAST(N'2020-04-05T10:04:22.893' AS DateTime), CAST(119.94 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-A1830091', N'1830091', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 2, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830121, 2789, 3, 1626115, 1653311, CAST(N'2020-04-05T00:00:00.000' AS DateTime), CAST(N'2020-04-05T10:07:31.893' AS DateTime), CAST(44.09 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-A1830121', N'1830121', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830167, 2789, 3, 1477899, 1521105, CAST(N'2020-04-05T00:00:00.000' AS DateTime), CAST(N'2020-04-05T10:16:31.000' AS DateTime), CAST(85.44 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-A1830167', N'1830167', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Não', NULL, 4, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830468, 2789, 3, 1628540, 1655536, CAST(N'2020-04-05T00:00:00.000' AS DateTime), CAST(N'2020-04-05T10:37:10.907' AS DateTime), CAST(164.62 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-A1830468', N'1830468', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 7, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830526, 2789, 3, 1590185, 1621127, CAST(N'2020-04-05T00:00:00.000' AS DateTime), CAST(N'2020-04-05T10:41:12.120' AS DateTime), CAST(107.36 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-A1830526', N'1830526', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Não', NULL, 9, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 1, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830541, 2789, 3, 971906, 1060175, CAST(N'2020-04-05T00:00:00.000' AS DateTime), CAST(N'2020-04-05T10:41:45.830' AS DateTime), CAST(28.29 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-A1830541', N'1830541', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Não', NULL, 4, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1830549, 2789, 3, 946327, 762493, CAST(N'2020-04-05T00:00:00.000' AS DateTime), CAST(N'2020-04-05T10:42:42.547' AS DateTime), CAST(50.55 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'CAN', N'--', N'2789-A1830549', N'1830549', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 3, 19, CAST(0.00 AS Decimal(12, 2)), N'Sem coletor', 3, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843060, 2789, 3, 1639503, 1665384, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T10:22:27.980' AS DateTime), CAST(44.09 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-B1843060', N'1843060', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843217, 2789, 3, 1639614, 1665486, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T10:18:26.423' AS DateTime), CAST(146.20 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-B1843217', N'1843217', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843244, 2789, 3, 1506942, 1547248, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T10:19:23.507' AS DateTime), CAST(84.67 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-B1843244', N'1843244', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Não', NULL, 3, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843247, 2789, 3, 1639634, 1665502, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T10:19:24.903' AS DateTime), CAST(58.27 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-B1843247', N'1843247', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 6, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 2, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843548, 2789, 3, 840474, 937561, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T10:31:45.063' AS DateTime), CAST(7.50 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'CAN', N'--', N'2789-B1843548', N'1843548', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 2, 19, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 1, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843553, 2789, 3, 1528953, 1566711, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T10:31:49.733' AS DateTime), CAST(88.90 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-B1843553', N'1843553', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 5, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 1, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1843783, 2789, 3, 1640040, 1665839, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T10:41:21.450' AS DateTime), CAST(39.89 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'CAN', N'--', N'2789-B1843783', N'1843783', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 3, 19, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 1, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1864778, 2789, 3, 1418340, 1467664, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T20:40:14.517' AS DateTime), CAST(92.86 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-B1864778', N'1864778', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Não', NULL, 8, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1865220, 2789, 3, 1651535, 1676011, CAST(N'2020-04-06T00:00:00.000' AS DateTime), CAST(N'2020-04-06T21:07:38.157' AS DateTime), CAST(80.28 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-B1865220', N'1865220', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 4, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868223, 2789, 3, 1659571, 1683183, CAST(N'2020-04-07T00:00:00.000' AS DateTime), CAST(N'2020-04-07T09:17:42.363' AS DateTime), CAST(69.94 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'CAN', N'--', N'2789-C1868223', N'1868223', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 2, 19, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 1, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868254, 2789, 3, 1137955, 1211746, CAST(N'2020-04-07T00:00:00.000' AS DateTime), CAST(N'2020-04-07T09:18:41.290' AS DateTime), CAST(26.95 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-C1868254', N'1868254', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Não', NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868291, 2789, 3, 1659616, 1683222, CAST(N'2020-04-07T00:00:00.000' AS DateTime), CAST(N'2020-04-07T09:20:34.827' AS DateTime), CAST(110.04 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-C1868291', N'1868291', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 8, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 1, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868371, 2789, 3, 1439066, 1462627, CAST(N'2020-04-07T00:00:00.000' AS DateTime), CAST(N'2020-04-07T10:13:39.487' AS DateTime), CAST(89.90 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-C1868371', N'1868371', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868413, 2789, 3, 850031, 946436, CAST(N'2020-04-07T00:00:00.000' AS DateTime), CAST(N'2020-04-07T10:15:07.213' AS DateTime), CAST(73.78 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-C1868413', N'1868413', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 5, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1868507, 2789, 3, 851056, 947402, CAST(N'2020-04-07T00:00:00.000' AS DateTime), CAST(N'2020-04-07T10:20:28.183' AS DateTime), CAST(66.41 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-C1868507', N'1868507', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Não', NULL, 3, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921314, 2789, 3, 624526, 736151, CAST(N'2020-04-08T00:00:00.000' AS DateTime), CAST(N'2020-04-08T21:17:18.550' AS DateTime), CAST(159.92 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-D1921314', N'1921314', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 3, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 1, 0, N'Sim', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921545, 2789, 3, 1699189, 1718311, CAST(N'2020-04-08T00:00:00.000' AS DateTime), CAST(N'2020-04-08T21:38:14.340' AS DateTime), CAST(45.95 AS Numeric(12, 2)), 0, N'ENTREGA', N'Visa Crédito Online', NULL, N'FIN', N'--', N'2789-D1921545', N'1921545', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921552, 2789, 3, 1454795, 1500423, CAST(N'2020-04-08T00:00:00.000' AS DateTime), CAST(N'2020-04-08T21:38:56.297' AS DateTime), CAST(51.90 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'FIN', N'--', N'2789-D1921552', N'1921552', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 1, NULL, CAST(0.00 AS Decimal(12, 2)), N'Com coletor', 0, 0, N'Nao', 1)
GO
INSERT [dbo].[Fat_pedidos] ([id_pedido], [id_loja], [id_plataforma], [id_cliente_endereco], [id_cliente], [dt_pedido], [dt_entrega_inicio], [valor_pedido], [online], [entrega], [forma_pgto], [pesquisa_avaliacao], [status], [Pgto_Online_Canal], [cod_pedido], [cod_pedido_loja], [cupom_codigo], [cupom_desconto], [cupom_patrocinado], [canal], [origem_midia], [dispositivo], [UltimaCompra], [QtddPedidosNaLoja], [QtddItens], [id_cancelamento_motivo], [vlr_desconto], [TemColetor], [SKUsEmRuptura], [SKUsEmDesistencia], [Houve_Ruptura], [Qtdd]) VALUES (1921618, 2789, 3, 1699274, 1718393, CAST(N'2020-04-08T00:00:00.000' AS DateTime), CAST(N'2020-04-08T21:46:01.127' AS DateTime), CAST(29.95 AS Numeric(12, 2)), 0, N'ENTREGA', N'Mastercard Crédito Online', NULL, N'CAN', N'--', N'2789-D1921618', N'1921618', NULL, CAST(0.00 AS Numeric(13, 2)), NULL, N'--', N'--', NULL, N'Sim', NULL, 1, 18, CAST(0.00 AS Decimal(12, 2)), N'Sem coletor', 0, 0, N'Nao', 1)
GO

@AdrianoSM Which version of SQL Server are you using? I’m getting errors, when trying to run this on 2017 Express:

ERROR: Unclosed quotation mark after the character string 
'cupom_codi'. Error Code: 105 

Incorrect syntax near 'cupom_codi'.

@flamber,

This is the version:

“Microsoft SQL Server 2017 (RTM-CU18) (KB4527377) - 14.0.3257.3 (X64) Nov 16 2019 01:14:50 Copyright © 2017 Microsoft Corporation Web Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)”

I looked to the scripts and appear correctly to me…

Hi @flamber.

Were you able to use the schema and reproduce the scenario?
I’m still with problem in so many reports like this and change to native query will demand so many efforts.

Tks!

@AdrianoSM No, I was not able to import the sample. It created an error like I wrote. Until this is reproduced and fixed, you would need to downgrade to 0.33 or convert the queries to SQL.

Iam getting the same issue here.

Every day starting at 21h ours time filters get the wrong results when selecting one specific day. They select the day before.

Its seen to be one timezone bug, since we are here at the GMT-3, that explain the situation that starts at 21h.

On the settings my timezone is correct (America/Sao Paulo) but we think that this setting isnt respected by the filter.

Tks