# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

## Calculated dimensions and variables

Hi ;

I have a bar graph with the following calculated dimension:

=if([Report Type]='Daily Report',[Carrier Alt Carrier Designator],

if([Report Type]='Weekly Report',[YearWeek],

if([Report Type]='Monthly Report',[DropMonth],

if([Report Type]='Overall Summary',[Load Group]))))

My expression is as follows:

=Round(sum(aggr(sum(DISTINCT if([Load Status] <>'Voided' and [Load Status]<>'Expired' ,[Weight (kg)])), [Lean ID])),1)/1000

If l select, report type 'Weekly report' , my dimension on the graph is [YearWeek] which is correct.

I have also created 2 variables, vmaxPeriod (calculated as max(YearWeek)) and vmaxPeriod_3 (calculated as max(YearWeek)-3).

I now want to limit dimensions displayed i.e. vMaxPeriod_3<=YearWeek<=vMaxPeriod.

How do l do this? Please assist.

Regards;

Moses

1 Solution

Accepted Solutions
MVP

## Re: Calculated dimensions and variables

Try like this

// In dimension

=if([Report Type]='Daily Report',[Carrier Alt Carrier Designator],

if([Report Type]='Weekly Report' and [YearWeek]>=vMaxPeriod_3 and [YearWeek]<=vMaxPeriod,[YearWeek],

if([Report Type]='Monthly Report',[DropMonth],

if([Report Type]='Overall Summary',[Load Group]))))

3 Replies
MVP

## Re: Calculated dimensions and variables

Try like this

// In dimension

=if([Report Type]='Daily Report',[Carrier Alt Carrier Designator],

if([Report Type]='Weekly Report' and [YearWeek]>=vMaxPeriod_3 and [YearWeek]<=vMaxPeriod,[YearWeek],

if([Report Type]='Monthly Report',[DropMonth],

if([Report Type]='Overall Summary',[Load Group]))))

Not applicable

## Re: Calculated dimensions and variables

Thanks, it worked but l am now getting a bar that does not have any yearweek, the yearweek is a dash '-'. Do you know why l now getting this bar?

MVP

## Re: Calculated dimensions and variables

This are the bars which are not satisfying the condition i.e. mark as null in the dimension tab >check suppress null option ..