# Introducing the all-new TIBCO Community site!

If you're seeking alternative community sites, explore ibi, Jaspersoft, and Spotfire.

# Hi, I am trying to find the increase in expenses by different department from Q1 to Q2. How can I create a chart for it

## Recommended Posts

FOr the table, we have information of the date, department and amount of expense.

The information is from Jan-Jun

How can I create a graph where I am able chart the difference between Q2 and Q1 expenses for each department.

Formula would look like this

Department 1: Apr + May + Jun - Jan -Feb -Marc (Department 1)

Department 2:Apr + May + Jun - Jan -Feb -Marc (Department 2)

##### Share on other sites

You can create bar chart with the department in the category column.

The Y-axis will have some numerical column. You can simple insert your formula in there to reflect the differences.

Bar chart is a standard. You can also use pie chart if the number of departments is not many.

##### Share on other sites

Spotfire has very helpful aggregation methods available for you to do something like this. It will be very beneficial for you, when your month column is of type datetime. This will allow you to use the time hierarchy (year -> quarter -> month -> ..) on the X-axis. And this can also be used on the Y-axis in your aggregation. As you will see later, the Y-axis will adjust accordingly.

So let's assume this dataset where I have a month column as a string. First I create a datetime coumn. Skip this step if your column already is of type datetime:

ParseDate("2021-" & [Month] & "-01","yyyy-MMM-dd")

Then I build different bar charts. On the X-Axis I have my datetime column with year/quarter/month. For the lower two charts I simply select a different aggregation method on the y-Axis.You can then move the position of the slider from month (center vis) to quarter (lower vis) to see how everything adjusts automatically. Isn't that beautiful ;)

When you select the aggregation method, the custom expression will be generated for you. Check the Spotfire help to learn more about "Level" and "number of steps". Or play around with your data to explore these features.