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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
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
avinashelite

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]))))

View solution in original post

3 Replies
avinashelite

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
Author

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?

avinashelite

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