# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

## Calculate Current Week - Previous Week Value

I want to calculate Growth, which is equal to Current two weeks data minus previous two weeks data, how can I achieve the same?

1 Solution

Accepted Solutions
Valued Contributor

## Re: Calculate Current Week - Previous Week Value

Hi

what does 'Latest week' represents ?  week  ?

My set analysis is based on days  not  WEEK !!!

=Sum( 1 {<DateField = {">=\$(=Date(Today()-14,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}}Growth)

 Will you post the sample qvw file , so that i can understand exact need ?

Sum(  {<WEEK = {">=\$(=Date([Latest Week]-14,'MM/DD/YYYY'))<=\$(=Date([Latest Week],'MM/DD/YYYY'))"}} TOTALAMOUNT)

9 Replies
MVP

Contributor II

## Re: Calculate Current Week - Previous Week Value

previous two weeks means previous year two weeks..????

Explain the question clearly braj..

Thanks

Valued Contributor

## Re: Calculate Current Week - Previous Week Value

For current two weeks

I am assuming current two weeks means next 2 weeks ?  (14 days)

=Sum({<DateField = {">=\$(=Date(Today()+14,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}} Growth)

Previous 2 weeks means  14 days ealier ?

=Sum({<DateField = {">=\$(=Date(Today()-14,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}} Growth)

or

like this ?

14 days ealier

=Sum({<DateField = {">=\$(=Date(Today()-14,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}} Growth)

28 days ealier

=Sum({<DateField = {">=\$(=Date(Today()-28,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}} Growth)

????

Regards

Allu

Not applicable

## Re: Calculate Current Week - Previous Week Value

Thanks Allu, it worked.

But when I applied Date filter, it gave me different value. How should I ignore the date filter?

Contributor II

## Re: Calculate Current Week - Previous Week Value

Nullify the date in set analysis.

Valued Contributor

## Re: Calculate Current Week - Previous Week Value

Hi

I am not sure about your query     : "How should I ignore the date filter?"

if you want the selection independent of SELECTION

14 days ealier

=Sum( 1 {<DateField = {">=\$(=Date(Today()-14,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}}Growth)

28 days ealier

=Sum( 1 {<DateField = {">=\$(=Date(Today()-28,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}}Growth)

Will you post the sample qvw file , so that i can understand exact need ?

Not applicable

## Re: Calculate Current Week - Previous Week Value

Thanks Allu, it worked.

But when I replaced today with my column name, it gave me blank. The expression I implemented is as below:

Sum(  {<WEEK = {">=\$(=Date([Latest Week]-14,'MM/DD/YYYY'))<=\$(=Date([Latest Week],'MM/DD/YYYY'))"}} TOTALAMOUNT)

Valued Contributor

## Re: Calculate Current Week - Previous Week Value

Hi

what does 'Latest week' represents ?  week  ?

My set analysis is based on days  not  WEEK !!!

=Sum( 1 {<DateField = {">=\$(=Date(Today()-14,'MM/DD/YYYY'))<=\$(=Date(Today(),'MM/DD/YYYY'))"}}Growth)

 Will you post the sample qvw file , so that i can understand exact need ?

Sum(  {<WEEK = {">=\$(=Date([Latest Week]-14,'MM/DD/YYYY'))<=\$(=Date([Latest Week],'MM/DD/YYYY'))"}} TOTALAMOUNT)

Not applicable

Thanks a lot...