当前位置: 动力学知识库 > 问答 > 编程问答 >

tableau - Calculating Last Year Total

问题描述:

I am using Tableau 8.2,How do I get the Last Year Total ?

i,e on applying filter Year=2013 then Total should represent the sales for 2012(Total)

I have Month/Year On the Columns.

The case is explained in `.twbx file.

网友答案:

There is a number of ways to accomplish that, and all of them depend on how you want to display data. I'll go with the view that you have a first column with the previous year figure, and a monthly series of current year (as I guess it is what you're trying to achieve).

The simplest way to achieve that is not doing it all in the same worksheet. Rather, do the monthly calculations in one sheet, and the last year calculation in another sheet, them put them side by side on a dashboard.

The monthly figures you already have (just drop the Last Year field). The Last year can be easily achieved by simply plotting SUM(Sales) on screen.

The trick is on how performing the filter. I would create a parameter (let's call it Year) and 2 fields to be used as filter. Current year filter: YEAR([Order Date]) = Year, and previous year filter: YEAR([Order Date]) = Year - 1

Than drag those filters to the proper worksheet (keep True values). Now you have a parameter that controls the filter on both sheets

分享给朋友:
您可能感兴趣的文章:
随机阅读: