# LENTO MOVIMIENTO PT
###### tags: `DataStudio`
[Link DataStudioT](https://datastudio.google.com/reporting/1p2R--BGr_vyNl1zprzCbGv3eEz6k4YfG/page/1yhFB)
```sql=
select
*
from
(
select
pt."name" nom,
a.id,
CASE
WHEN
pp2.default_code ISNULL THEN ' --- '
ELSE
pp2.default_code
END AS ept,
pu.name AS uom,
case
when (last_date.fecha at time zone 'UTC-6')::timestamp::date isnull then '2018-11-01'::date
else (last_date.fecha at time zone 'UTC-6')::timestamp::date end as fecha,
case
when (now() at time zone 'UTC-6')::timestamp::date - (last_date.fecha at time zone 'UTC-6')::timestamp::date isnull then (now() at time zone 'UTC-6')::timestamp::date - '2018-11-01'::date
else (now() at time zone 'UTC-6')::timestamp::date - (last_date.fecha at time zone 'UTC-6')::timestamp::date end as s_mov,
case
when (now() at time zone 'UTC-6')::timestamp::date - (last_date.fecha at time zone 'UTC-6')::timestamp::date isnull then trunc( ((now() at time zone 'UTC-6')::timestamp::date - '2018-11-1'::date)::numeric / 30.41, 2)
else trunc(((now() at time zone 'UTC-6')::timestamp::date - (last_date.fecha at time zone 'UTC-6')::timestamp::date)::numeric / 30.41, 2) end as s_mov_mes,
case
when (now() at time zone 'UTC-6')::timestamp::date - (last_date.fecha at time zone 'UTC-6')::timestamp::date isnull then 'Obsoleto'
else '-----' end as estado,
a.location_stock_id ,
a.familia_producto ,
a.nave_fabricacion ,
a.stock_qty_location as Cantidad_sistema,
a.product_id ,
a.name,
--a.platform_pieces ,
--a.udv ,
--a.categ_id ,
a.package_type ,
a.tipo_abastecimiento
from
analisis_productos_abc a
left join (
select
stock_pack_operation.product_id as pid,
max(sp.date_done) as fecha
from
stock_pack_operation
inner join stock_picking sp on
stock_pack_operation.picking_id = sp.id
and sp.location_dest_id = 9
and sp.picking_type_id in (4,
125)
and sp.state in ('done',
'documentado')
inner join stock_picking_type spt on
sp.picking_type_id = spt.id
and code = 'outgoing'
group by
stock_pack_operation.product_id
order by
fecha desc) as last_date on
a.product_id = last_date.pid
inner join product_product pp on
a.product_id = pp.id
inner join product_template pt on
pp.product_tmpl_id = pt.id
and pp.default_code like 'P%'
INNER JOIN product_uom pu ON pt.uom_id = pu.id
INNER JOIN mrp_bom mb ON pp.id = mb.product_id
LEFT JOIN mrp_bom_line mbl ON mb.id = mbl.bom_id and mbl.product_uom_id IN ('11', '3')
LEFT JOIN product_product pp2 ON mbl.product_id = pp2.id
where
a.stock_qty_location is not null
and current_count_sales_by_month = 0) ok
where
s_mov >120;
```