Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

sum statement with two conditions

Hi There,

I successfully loaded a master calendar with Year, Month and Day which reflects order date. I want to find the total sales in previous year when currency code is USD.

The expression I am using is Sum({<[CurrencyCode]={'USD'},OrderDate={=MakeDate(Year-1,num(Month),Day)}>}Sale), but Qlikview returns me an error.

Can anybody tell me what went wrong and how to fix it? Thanks so much!

Best Regards,

Gloria

3 Replies
erikzions
Contributor

Re: sum statement with two conditions

I believe you need to use an expansion on the second condition.  Try somthing like this.


Sum({<

     [CurrencyCode]={'USD'}

     ,OrderDate={$(=MakeDate(Year-1,num(Month),Day))

     }>}Sale)

MVP
MVP

Re: sum statement with two conditions

is your order date associated to master calendar?


=sum( {$<[CurrencyCode]={USD},Year={$(=max(Year)-1) }>}  Sale)

Not applicable

Re: sum statement with two conditions

Hi Erik,

Thank you for your reply. But this one seems not work. One of my concern is actually when multiple dates are selected. For example, when Year=2014, Month=01, Day=01,02,03,04,05, can I use makedate to display 01/01/2014,01/02/2014,01/03/2014, 01/04/2014,01/05/2014? If MakeDate does work, can I use OrderDate=Makedate(Year-1, num(Month), Day) to get the data when OrderDate=01/01/2013,01/02/2013,01/03/2013,01/04/2013, 01/05/2013?

Thank you so much!

Best Regards,

Gloria

Community Browser