I am working on a query for collecting some data on Microsoft Parallel data warehouse(PDW).
A part of the query is as follows --
Select
min(rows) as rows_min,
max(rows) as rows_max,
sum(rows) as rows_total,
cast((((max(rows)-min(rows))/sum(rows))*100) as float) as SkewPct;
from .....;
Apparently query doesn't show any error. It runs successfully but with correct data in all columns except SkewPct which shows only zeros.
Please help me out to solve this issue!
I think you are missing multiplication of 1.0 during divide as below:
Divide removes the fraction before converting it into float