I need to find the percent the product was on shelf.
So I use this query:
select
*,
cast((t1.CountProd / t1.SumProd)*100 as dec(12,10)) as asasa
from
(select
*,
count(Nalichie) over (partition by ProductID) as CountProd,
count(Nalichie) over() as SumProd
from
[saleit_db_Danone].[OSA].[tbl_FullFCompetitive]) as t1
Why do I get 0
in the last column?
Here is my result: