Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

YeartoDate PY with 53 weeks

Hi all,

Our definition is that for YearToDate (YTD) we take max 52 weeks. Normally we defined PastYear YTD (PYYTD) as Commercialyear -1 and took the same (max) week. Now we've changed our formula and it works fine directly in the expression. But we work with include variable files (.txt). If I place the variable in the file it doesn't work anymore. THe only change to the expression is that in the variable we need to use the ALT codes.

Can you please help me?

LET vNetSalesPYYTD = 'sum({<CommercialYear=,Week=,WeekSerial={">='&CHR(36)&'(=max(WeekSerial-if(Week='53', 52, 52+Week-1))),<='&CHR(36)&'(=max(WeekSerial-52))"}>}Sales)';

Best regards,

Astrid

1 Solution

Accepted Solutions
Not applicable

Re: YeartoDate PY with 53 weeks

I've found the solution:

LET vNetSalesPYYTD = 'sum({<CommercialYear=,Week=,WeekSerial={">='&CHR(36)&'(=max(WeekSerial-if(Week="53", 52, 52+Week-1))),<='&CHR(36)&'(=max(WeekSerial-52))"}>}Sales)';

so it was " in stead off '

1 Reply
Not applicable

Re: YeartoDate PY with 53 weeks

I've found the solution:

LET vNetSalesPYYTD = 'sum({<CommercialYear=,Week=,WeekSerial={">='&CHR(36)&'(=max(WeekSerial-if(Week="53", 52, 52+Week-1))),<='&CHR(36)&'(=max(WeekSerial-52))"}>}Sales)';

so it was " in stead off '