Skip to main content

I have attached sample data which has the sales in four different states. The data would be looking like the image shown below.

 

How to display the previous month data under current month using calculated fields

once i load the data in Tableau and create a table, with months as column and States as rows and Sum(sales) as text, it would look like the following image.

Tableau table image1

But client wants to see the previous months sales data under current month. For example, Under February column, January sales data has to be displayed, under march column, February data has to be displayed and so on.

 

I have been struggling so much to come up with the logic. Could anyone please help me with the logic. I have also attached Excel sheet and Tableau file.

4 answers
  1. Jul 29, 2020, 8:29 PM

    Hello @Arunraj Elangovan​ ,

     

    Try this calculation.

     

    lookup(SUM([Sales]),-1)

     

    Hope this helps! See attached.

     

    @Robert Breen​ 

0/9000