Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tyagishaila
Specialist
Specialist

YTD

Hi,

what is the script to get YTD (Year Till Date)?

YTD 13-14

YTD 12-13 and so on

e.g As today is 11 Dec,

YTD 12-13 means (01 April 12) to (11 Dec 13)

YTD 13-14 means( 01 April 13) to (11 Dec 14)

pick data for this time interval

7 Replies
pljsoftware
Creator III
Creator III

Hi Tyagi,

YTD can be calculated in different way, depend about your data model.

Usually I use set analysis with a field date.

An example in attachment

Regards

Luca Jonathan Panetta

Not applicable

if you want calculate YTD sales then use the YeartoDate function to create the YTD flag

YeartoDate( DateField , 0 ,4) AS YTDFlag

tyagishaila
Specialist
Specialist
Author

Thanks Panetta,

Its very helpful answer.

On Fri, Dec 12, 2014 at 8:08 PM, Panetta Luca Jonathan <

Not applicable

also check  inyeartodate

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=Sum({<YearDimension=, QuarterDimension=, MonthDimension=, DateDimension={'>=$(=YearStart(Today(), 0, 4))<=$(=Today())'}>} Sales)

The above expression will you the Sales for the YTD.

Note: Replace YearDimension, QuarterDimension, MonthDimension and DateDimension with your actual dimension names.

Regards,

Jagan.

tyagishaila
Specialist
Specialist
Author

Hi dathu,

Thanks for you answer.

But I have no idea, How to use flag

jagan
Luminary Alumni
Luminary Alumni

Hi,

If you need in script then try like this

Data:

LOAD

*,

If(YearToDate(DateDimension, 0, 4), 1, 0) AS YTDFlag

FROM DataSource;

Hope this helps you.

Regards,

Jagan.