Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

amit_saini
Honored Contributor III

YTD Help???

Hi Folks ,

I'm having expression as below:

if(sum([Act Planned Production Hours]) = 0, avg([Act OEE]),
sum([Act OEE]*[Act Planned Production Hours])/sum([Act Planned Production Hours]))

Need to calculate YTD from this . Any suggestions???

Thanks,

AS

1 Solution

Accepted Solutions
amit_saini
Honored Contributor III

Re: YTD Help???

Hi Timanshu,

I got the solution for this:

if(sum({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act Planned Production Hours]) = 0, avg({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act OEE]),

sum({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act OEE]*[Act Planned Production Hours])/sum({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act Planned Production Hours]))

Thanks,

AS

9 Replies

Re: YTD Help???

YTD can be calcualated as below

SUM({<Year = , Month = , Date = {'>=$(=YearStart(Today()))<=$(=Today())'}>}MeasureField)

amit_saini
Honored Contributor III

Re: YTD Help???

Hi Manish,

Thanks brother I already tried something similar and your suggestions also but getting blank values.

Thanks,

AS

Re: YTD Help???

Provide sample data please...

Not applicable

Re: YTD Help???

Hi,

Create a varible      vCurrDate=today()-1

YTD

sum({<Months=,  FiscalYear={$(=max(FiscalYear))},TRANDATE={"<=$(vCurrDate)"}>} [Act OEE]*[Act Planned Production Hours])

Regards

Vimlesh

timanshu
Contributor III

Re: YTD Help???

if(sum({<Year = , Month = , Date = {'>=$(=YearStart(Today()))<=$(=Today())'}>}[Act Planned Production Hours])=0,

avg({<Year = , Month = , Date = {'>=$(=YearStart(Today()))<=$(=Today())'}>}[Act OEE]),
sum({<Year = , Month = , Date = {'>=$(=YearStart(Today()))<=$(=Today())'}>}[Act OEE]*[Act Planned Production Hours])/
sum({<Year = , Month = , Date = {'>=$(=YearStart(Today()))<=$(=Today())'}>}[Act Planned Production Hours]))

amit_saini
Honored Contributor III

Re: YTD Help???

See attachment.

Thanks,
AS

amit_saini
Honored Contributor III

Re: YTD Help???

Hi Manish,

See the attachment:

Need to calculate Act  2015 YTD

Thanks,

AS

timanshu
Contributor III

Re: YTD Help???

Hi Amit,

Access is denied to document you attached.

It's showing error: Access denied to this qlikview document.

amit_saini
Honored Contributor III

Re: YTD Help???

Hi Timanshu,

I got the solution for this:

if(sum({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act Planned Production Hours]) = 0, avg({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act OEE]),

sum({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act OEE]*[Act Planned Production Hours])/sum({<Date={">=$(=YearStart(Date))<=$(=Max(Date))"},Year={2015},POPER_NEW=,Date=>}[Act Planned Production Hours]))

Thanks,

AS

Community Browser