Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD

Hi

InYTD what is mean by YTD={1} and YTD={0}?

Labels (1)
11 Replies
juleshartley
Specialist
Specialist

Sorry, you will have to explain. What do you mean by YTD? Do you mean the 'Year2Date' expression?


Not applicable
Author

Yes

Not applicable
Author

Its Set Expression, see manual at topic Set Analysis

This is solution to override user's selections for most aggregation functions.

Colin-Albert
Partner - Champion
Partner - Champion

This is part of a set expression doing a comparison on a field named YTD to a numeric value

YTD={1} is the equivalent of   "where YTD = 1"  or "if YTD =1"

YTD={0} is the equivalent of   "where YTD = 0" or "if YTD = 0"

Not applicable
Author

Hi Colin

Thanks for replay

What it mens exactly if i place YTD={1} and YTD={0}(1 and 0 represents?)

Colin-Albert
Partner - Champion
Partner - Champion

To include two values as part of a set modified you would use   YTD={0,1}

If the values were text then syntax would be      FieldName = {'A', 'B','C'}

The curly braces indicate that the field is being compared to a set of values.

Not applicable
Author

In set analysis i need to calculate Sales on YTD Basis can i write expression for

Current Year: Sum({<Year={$(currentYear)},YTD={1}>}Sales)  (Here Current Year means -2014)

Previous Year: Sum({<Year={$(PreviousYear)},YTD={1}>}Sales)  (Previou Year means-2013)

is it correct?

if i place YTD={0} insted of YTD={1} then is there any result changes?

JonnyPoole
Former Employee
Former Employee

Sanjeev ,  1 and 0 likely mean the field 'YTD' is a boolean flag. This is a common technique when you have a calendar table.  It is common to create a boolean flag field to denote whether the date value on a specific row of the calendar table falls within the current year to date period.  With the flag in place it is very easy to slice a dashboard to see YTD values only.  For the context of a chart to show YTD values only,  a SET EXPRESSION such as follow with YTD={1} would focus the chrat to show YTD values only:

sum(   {$<YTD={1}>}  Sales)

Not applicable
Author

Thanks for Explanation,

If i want previous year sales in YTD

then

can i write like this? Sum({<Year={$(Previous Year)},YTD={1}>}Sales)