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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasmahajan

Expression Help Required

Dear All

I have sales report as per following format

Product     CM   LM

--------------------------------

ABC         100   80

XYZ           200  100

PQR          400  200

The expression required for calculation of sales like wise comparision  for eg.   if  today is 15 feb 2013  then sum(sales) as on 15/feb/2013 required

and for lm  sum of sales as on 15-feb-2012 (Likewise). Now if date is 28-feb-2013  for cm  then  for last year it sould take 28/feb/2012  as well as 29/feb/2012

due to last year was a leap year.

Please help to build this expression.

I have attach sample application for refer

Thanks in advanace

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
1 Solution

Accepted Solutions
Not applicable

Hi Vikas,

you can create a calculated dimension (see attached app.) and map the date from 29/02/ to 28/02/, independend of the year.

Even better in my oppinion is to  let the (field-)calculation be done during loading time, instead of calculation a dimension online.

May be like this

LOAD

     *,

=if(SubField(date,'/',1) = '29' and SubField(date,'/',2) = '02',

'28/02/' & SubField(date,'/',3),

date) AS date

FROM somewhere;

HtH

Roland

View solution in original post

2 Replies
Not applicable

Hi Vikas,

you can create a calculated dimension (see attached app.) and map the date from 29/02/ to 28/02/, independend of the year.

Even better in my oppinion is to  let the (field-)calculation be done during loading time, instead of calculation a dimension online.

May be like this

LOAD

     *,

=if(SubField(date,'/',1) = '29' and SubField(date,'/',2) = '02',

'28/02/' & SubField(date,'/',3),

date) AS date

FROM somewhere;

HtH

Roland

vikasmahajan
Author

Thanks a Lot Sir , I will Try n Get Back you..

Bye

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.