Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ncarson4
Contributor
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!

Labels (3)
1 Solution

Accepted Solutions
CarlosAMonroy
Creator III
Creator III

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
Creator III
Creator III

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

 

ncarson4
Contributor
Contributor
Author

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.