Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Logic Help

HI all,

i want one analysis Current year Vs Previous Year but in this i want suppose CY i having 4 month as Per Fiscal Year Apr,May,Jun,July 2015,

Now i want PY should contain Same Four month which as Current Year, Not Full year..

How i can do this??

please suggest

11 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

What you are describing, is called Current Year-To-Date vs. Prior Year-To-Date.

The function in QlikView and Qlik Sense that calculates that, is called InYearToDate(). It's common to pre-calculate YTD flags (simple 1/0 fields) for all Calendar dates, and to use the YTD flags in all chart expressions that require this logic.

I'm describing these techniques in a lot of detail in my new book QlikView Your Business, which is now featured on Qlik Market - check it out!

cheers,

Oleg Troyansky

QlikView Your Business: An expert guide to Business Discovery with QlikView and Qlik Sense

abhaysingh
Specialist II
Specialist II
Author

Hey Any one Here who can help me in this??

thanks in Advance

help4qv123
Creator II
Creator II

Do u have date field in your app ...

help4qv123
Creator II
Creator II

Create 2 Variables:

vmax= date(addyears(max(Date), -0))

vmax1= date(addyears(max(Date),  -1))

And Now Your expression will be :

PreYear:

=sum({<Year={'$(=max(Year)-1)'},Date={'<=$(vmax1)'},Month>}Value)

CurrYear:

=sum({<Year={'$(=max(Year))'},Date={'<=$(vmax)'},Month>}Value)

abhaysingh
Specialist II
Specialist II
Author

yes

Sum({<Fiscal Year = {'$(=Max(Year))'} >}Sales)  for YTD

Sum({<Fiscal Year = {'$(=Max([Year]-1))'} >}Sales)  for PYTD but it is giving me 12 month sales i want watever CY Month has been covered i.e. suppose for fiscal year 2015-2016 month Covered are Apr,May,Jun,July....

i want PYTD shud give Apr,May,Jun,July Sales while comparing.



thanks

Abhay

help4qv123
Creator II
Creator II

Check the above expressions creating two variables.

Let me know if u have any issues.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expressions

Current Year:

Sum({<Year=, FiscalYear=, Month=, Quarter=, DateFieldName={'>=$(=YearStart(Today(), 0, 4))<=$(=Today())'}>} Sales)

Current Year:

Sum({<Year=, FiscalYear=, Month=, Quarter=, DateFieldName={'>=$(=YearStart(Today(), -1, 4))<=$(=YearEnd(Today(), -1, 4))'}>} Sales)

Replace Year, FiscalYear, Month, Quarter and DateFieldName with your actual field names.

Hope this helps you.

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Check this Fiscal calendar generation script

Fiscal and Standard Calendar generation

Regards,

Jagan.

qlikviewwizard
Master II
Master II

Nice explanation. Thank you for answer.