# New to QlikView

Discussion board where members can get started with QlikView.

New Contributor III

## What is difference between YTD, PYTD and YOY,

Hi QV Experts,

Can any one help me with what is YTD, PYTD and why we use this. How to write those expressions in front end and in back end.

Also I went to what is the difference between YOY and YTD.

What exactly mean by YOY and YTD. Can any one tell me the expressions for that.

thanks,

M@dhu

1 Solution

Accepted Solutions
Not applicable

## Re: What is difference between YTD, PYTD and YOY,

May be you can try as below three expression with 2014-2013, 2013-2012, 2012-2011 as labels accordingly for below expression:

=((sum({\$<Year = {\$(=max(Year))}>}Sales) - sum({\$<Year ={\$(=max(Year)-1)}>}Sales))/ sum({\$<Year = {\$(=max(Year)-1)}>}Sales)) * 100

=((sum({\$<Year = {\$(=max(Year)-1)}>}Sales) - sum({\$<Year ={\$(=max(Year)-2)}>}Sales))/ sum({\$<Year = {\$(=max(Year)-2)}>}Sales)) * 100

=((sum({\$<Year = {\$(=max(Year)-2)}>}Sales) - sum({\$<Year ={\$(=max(Year)-3)}>}Sales))/ sum({\$<Year = {\$(=max(Year)-3)}>}Sales)) * 100

11 Replies
Contributor II

## Re: What is difference between YTD, PYTD and YOY,

Hi M@dhu,

Do u have any QVW file, if u have post it?

MVP

## Re: What is difference between YTD, PYTD and YOY,

YTD = Year To Date

For Current Year... Data From 01/01/2016 to 24/11/2016 (Today's Date)

PYTD = Previous Year To Date

For Current Year... Date From 01/01/2015 to 24/11/2015 (Last Years' Today's date)

For YOY check this blog..

Year-over-Year Comparisons

Not applicable

## Re: What is difference between YTD, PYTD and YOY,

Year, Quarter, Month and Week To Date are the common analysis that I seen many applications. I will share the expression to do here

First to do this your data model should have the DateField in number format by applying floor

Similar to this

Floor(DateField) AS DateNum //it will gives you one whole number to represent date

YTD - Year To Date

A date should be selected and it will look for the Starting date of the year to the selected date.

Ex: date selected is 21-03-2014 then YTD is 01-01-2014 to 21-03-2014

Expression would be

Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=\$(=Num(YearStart(Max(DateNum))))<=\$(=Max(DateNum))"}>} Sales)

QTD- Quarter to Date

In the place of year use Quarter

Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=\$(=Num(YearStart(Max(DateNum))))<=\$(=Max(DateNum))"}>} Sales)

MTD- Month to Date

Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=\$(=Num(MonthStart(Max(DateNum))))<=\$(=Max(DateNum))"}>} Sales)

WTD- Month to Date

Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=\$(=Num(WeekStart(Max(DateNum))))<=\$(=Max(DateNum))"}>} Sales)

if you want you can set a variable value as 'Year', 'Month', 'Quarter', 'Week', lets say vToDate and go with single chart and single expression

Sum({<Year=, Month=, Quarter=, Week=, DateField=, DateNum={">=\$(=Num(\$(=vToDate& 'Start(Max(DateNum))')))<=\$(=Max(DateNum))"}>} Sales)

Valued Contributor III

## Re: What is difference between YTD, PYTD and YOY,

YOY- ex:-overall sales from current year to previous year.

https://community.qlik.com/blogs/qlikviewdesignblog/2014/03/03/ytd

Set Analysis for certain Point in Time

For PYTD

YTD &amp; PYTD as Selection?

Arvind 64 explaind about PYTD with example code.

New Contributor III

## Re: What is difference between YTD, PYTD and YOY,

Hi Dinesh,

No I don't have any QVW..

Thanks,

New Contributor III

## Re: What is difference between YTD, PYTD and YOY,

Hi Manish,

How to define the expressions in front end and back end for YTD, PYTD, MTD,PMTD,QTD,PQTD

Thanks,

M@dhu

MVP

## Re: What is difference between YTD, PYTD and YOY,

Highlighted
New Contributor III

## Re: What is difference between YTD, PYTD and YOY,

Hi Habib Shaik,

Thanks for your reply. Can you also help me with the YOY expressions.

Thanks,

M@dhu

New Contributor III

Hi Rama Sai,