Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
ncarson4
New Contributor

Calculated Dimension for Barchart

Hi, I could use some help from this expert community. I'm trying to make a barchart that would display the following values based on a MonthYear dimension in my dataset:

1) Current Month

2) Prior Month

3) 2 mos Prior

4) Year Prior

5) A user inputted/adjustable Baseline period

These values should all adjust as the user selects a new month.

An example of the Dimension I would like to have if the current month is November

Values.JPG

Format I would want the barchart to look like:

Chart Format.JPG

Any help you could provide would be greatly appreciated. Thanks!

1 Solution

Accepted Solutions
CarlosAMonroy
Contributor III

Re: Calculated Dimension for Barchart

Hi,

Well, you can create the calculated dimension as follows:

Create the following variable, and then add the Calculated dimension.

vMaxDateSelected = Date(Max(DateField));

=IF(DateField <= AddMonths('$(vMaxDateSelected)',-2), 'M-2',
IF(DateField <= AddMonths('$(vMaxDateSelected)',-1), 'M-1',
IF(DateField <= AddMonths('$(vMaxDateSelected)',0), 'Current Month')))

 

Hope that helps,

Carlos M

 

View solution in original post

2 Replies
CarlosAMonroy
Contributor III

Re: Calculated Dimension for Barchart

Hi,

Well, you can create the calculated dimension as follows:

Create the following variable, and then add the Calculated dimension.

vMaxDateSelected = Date(Max(DateField));

=IF(DateField <= AddMonths('$(vMaxDateSelected)',-2), 'M-2',
IF(DateField <= AddMonths('$(vMaxDateSelected)',-1), 'M-1',
IF(DateField <= AddMonths('$(vMaxDateSelected)',0), 'Current Month')))

 

Hope that helps,

Carlos M

 

View solution in original post

ncarson4
New Contributor

Re: Calculated Dimension for Barchart

Thanks! Yeah I was able to get it working using a combination of a baseline variable and a 4 month string variable that is created based on the max month-year available. Maybe not ideal, but it is running well so that solves the problem at least.