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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD Problem

Hi guys,

I've a typical problem of YTD.

My user have the ability of filtering the Year, Month and Day of Sales Revenue.

The question is that I cannot show the YTD value when a Month or a Day is filtered because the YTD values excludes all other months.

I have this Sum Expression:

SUM({$<Year={$(LAST_WORKDAY_REPDATE_VAR)}>}Sales)

Where LAST_WORKDAY_REPDATE_VAR is a variable that holds the Year of a Calendar selection, but I can't get no results from this expression.

Thanks in advance for your help.

Mário

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

The first $ in your expression is telling it to include all selections. So you're explicitly telling it to include the Month and Day selections when doing the sum. Instead, you need to tell it to IGNORE the month and day selections (as well as any other fields that are in your calendar). Something like this:

sum({<Month=,Day=,Year={$(LAST_WORKDAY_REPDATE_VAR)}>} Sales)

Another thing you need to make sure of is that the Year field and the LAST_WORKDAY_REPDATE_VAR are formatted the same, as set analysis appears to do a text rather than numeric comparison.

View solution in original post

6 Replies
johnw
Champion III
Champion III

The first $ in your expression is telling it to include all selections. So you're explicitly telling it to include the Month and Day selections when doing the sum. Instead, you need to tell it to IGNORE the month and day selections (as well as any other fields that are in your calendar). Something like this:

sum({<Month=,Day=,Year={$(LAST_WORKDAY_REPDATE_VAR)}>} Sales)

Another thing you need to make sure of is that the Year field and the LAST_WORKDAY_REPDATE_VAR are formatted the same, as set analysis appears to do a text rather than numeric comparison.

Not applicable
Author

Thank you very much!!

Great TIP!

Not applicable
Author

Can you help me in another question related to this?

I have a calendar and I have mapped, as you say, and it is working almost perfectly:

sum({<Data=, Month=,Year={$(=(Year))}>} Sales)

The only problem is this: If the use selectes the Date: 05-08-2009, I want to show the YTD value until that date, and not until today.

I've changed the expresion to this:

sum

({<Data<={$(Data)}, Month=,Year={$(=(Year))}>} Quantidade)

But I can't get the desired results.

Thanks for all your help



Not applicable
Author

Can you help me in another question related to this? I have a calendar and I have mapped, as you say, and it is working almost perfectly: sum({} Sales) The only problem is this: If the use selectes the Date: 05-08-2009, I want to show the YTD value until that date, and not until today. I've changed the expresion to this: sum({} Quantidade) But I can't get the desired results. Thanks for all your help
Not applicable
Author

I've found the answer: sum({} Sales) Thanks buddy!
Not applicable
Author

I've put the >= like this post and worked! http://community.qlik.com/forums/p/20981/80535.aspx#80535 Thanks again!