# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Contributor II

## Recent 4 fiscal weeks excluding this week

Hi all,

I have a master calendar, where i load fiscal week and fiscal date.

I want to load a new dimension where it contains the recent 4 fiscal weeks but not this week.

Can someone pls help me on this.

current fiscal week statement i'm using.

if(week(SoldDate) > 5,week(SoldDate)-5, week(SoldDate) + 47) as [Fiscal Week]

Tags (1)
1 Solution

Accepted Solutions
MVP

## Re: Recent 4 fiscal weeks excluding this week

Not sure if I understand completely, but may be this:

If(Match(Week(SoldDate), Week(Today())-1, Week(Today())-2, Week(Today())-3, Week(Today())-4), Week(SoldDate)) as [Fiscal Week]

6 Replies
MVP

## Re: Recent 4 fiscal weeks excluding this week

Not sure if I understand completely, but may be this:

If(Match(Week(SoldDate), Week(Today())-1, Week(Today())-2, Week(Today())-3, Week(Today())-4), Week(SoldDate)) as [Fiscal Week]

Contributor II

## Re: Recent 4 fiscal weeks excluding this week

Thanq Sunny...

Welcome back bro.

MVP

No problem Mark

Best,

Sunny

Contributor II

## Re: Recent 4 fiscal weeks excluding this week

Sunny, i have a small question.

The last weeks were showing for both 2014 and 2015. We need it only for 2015.

I tried giving the condition Max(year) and '2015' in If condition but its just loading nothing.

MVP

## Re: Recent 4 fiscal weeks excluding this week

May be this:

If(Match(Week(SoldDate), Week(Today())-1, Week(Today())-2, Week(Today())-3, Week(Today())-4) and Year(SoldDate) = Year(Today()), Week(SoldDate)) as [Fiscal Week]

Contributor II

## Re: Recent 4 fiscal weeks excluding this week

Hi Sunny,

It worked.

I tried in the other way, which too worked:

If([SoldDate]>= (Today()-28) and  [SoldDate] < (Today()),Week([SoldDate])) as [Last 4 Weeks]

Thank you again buddy