Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to use aggregation function without group by

Hi ,

I have a piece of code and its throwing invalid expression error when i execute it.I am not using group by on the basis of count function. Thats why its showing error.But i dont want to use group by here dats my requirement.

Please let me know how can i achieve the above requirement.

load

     '$(i)' as Month,

     fd_code as [Client source],

     if(pri_code=1 and  wc_code= '01' and wo_Diff <='1' ,count(wo_number)) as [No Of Work Orders 1]

   if(pri_code=1 and  wc_code = '01'  ,count(wo_number)) as [No Of Work Orders 1.1],

    if(pri_code=2 and  wc_code = '01' and wo_Diff <=2,count(wo_number)) as [No Of Work Orders 2]

from $(vQVDDataDir)\XYZ.qvd (qvd)

     where num(month(floor(wo_completionDate))) >= '$(i)'-1 and num(month(floor(wo_completionDate))) <= '$(i)' and year(floor(wo_completionDate))='2015'

     and isnull(proj_number) and pri_code='$(j)' and  wc_code = '$(j)' and wo_Diff <='$(j)'

     group By

     fd_code;

Thanks,

Vasudha Mishra

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If you don't want a group by then don't add any fields that aren't aggregated. You're using fd_code, pri_code, wc_code and wo_Diff without aggregating them, so these fields must be part of the group by clause. There is NO way to do it otherwise.


talk is cheap, supply exceeds demand