Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

YTD from previous year

Hello togehter,

I have a YTD Formula (it Shows the right figures)

Sum({$<Nature={'Actual'},[Fiscal Year]=, month=, DateNum={">=$(Num(YearStart(Max(DateNum))))<=$(=(Max(DateNum)))"}>} Amount)

this formula Shows the wrong figures

Sum({$<Nature={'Actual},[Fiscal Year]=, month=, DateNum={">=$(=Num(YearStart(Max(DateNum),-1)))>=$(=AddYear(max(DateNum), -1 ))"}>}Amount)

Do you know why? and could help me.

Thanks

1 Solution

Accepted Solutions
crusader_
Valued Contributor

Re: YTD from previous year

Oh, Are you sure about AddYear function???

Try this

Sum({$<Nature={'Actual},[Fiscal Year]=, month=,

               DateNum={">=$(=Num(YearStart(Max(DateNum),-1)))<=$(=Num(AddMonths(max(DateNum), -12 )))"}>}

          Amount)

10 Replies

Re: YTD from previous year

Hi,

Have a look at below post.

http://community.qlik.com/docs/DOC-7045

Regards

ASHFAQ

crusader_
Valued Contributor

Re: YTD from previous year

Hi,

Smth wrong in your >= <= logic I suppose.

Sum({$<Nature={'Actual},[Fiscal Year]=, month=, DateNum={">=$(=Num(YearStart(Max(DateNum),-1)))>=$(=AddYear(max(DateNum), -1 ))"}>}Amount)


Please check it.

Hope this helps.

Andrei

MVP
MVP

Re: YTD from previous year

Sum({$<

Nature={'Actual},

[Fiscal Year]=,

month=,

DateNum= {“$(=Num(YearStart(Max(DateNum)),-1))<=$(=AddYear(Max(DateNum),-1))”}Amount)

Not applicable

Re: YTD from previous year

This is the formula of this post with the Appendix Nature={'Actual'}

Not applicable

Re: YTD from previous year

I Shows only 0 and no values.

Can give me hint why?

Not applicable

Re: YTD from previous year

this code Show nothings no figure only a space.

Do you have a other question?

MVP
MVP

Re: YTD from previous year

Yes, Provide sample data :-)

crusader_
Valued Contributor

Re: YTD from previous year

Oh, Are you sure about AddYear function???

Try this

Sum({$<Nature={'Actual},[Fiscal Year]=, month=,

               DateNum={">=$(=Num(YearStart(Max(DateNum),-1)))<=$(=Num(AddMonths(max(DateNum), -12 )))"}>}

          Amount)

Not applicable

Re: YTD from previous year

What do you mean with sample data? The structure of the table?

Community Browser