3 Replies Latest reply: Feb 6, 2014 8:04 AM by Fabrice Aunez

# Are YTD calculations so difficult or am I missing something?

Hello to all qlikers,

In the attached file is a very simple sales report. My problem is that I cannot create an expression to calculate the YTD Sales.

The expression used is :

sum({\$<Month={"<=\$(=max(Month))"}, Week={"<=\$(=max(Week))"}>}TOTAL<Market> Value)

I used the TOTAL<Market> modifier to instruct qlik to ignore the dimension values of Month & Week when calculating the sum,otherwise no matter what I declare in the set expression Month & Week are filtered on the row values.

The wrong part, I suppose, is the use of \$(=max(Month)) and \$(=max(Week)) to get the current Month & Week dimesion values for each row, but I don't know the correct way. When using just \$(=(Month)) the sum returns always 0.

Any bright ideas?

Thanks

• ###### Re: Are YTD calculations so difficult or am I missing something?

Hello,

I think you can try this expression:

sum({<Month={'<=\$(=max(Month))'}>} Sales)

It works for me!

• ###### Re: Are YTD calculations so difficult or am I missing something?

HI,

use RangeSum and Above function

Hope it helps you

Regards,

Divya

• ###### Re: Are YTD calculations so difficult or am I missing something?

Take care: the set analysis will be computed only ONCE per chart

It means that you will get the same for all the rows. If you want to get a different set for a different YTD (one set of month per row), you need another technique.

See a doc I have written on that topic: http://community.qlik.com/docs/DOC-4821

Fabrice