6 Replies Latest reply on Oct 25, 2016 11:28 PM by Kalyan Chakravarthi Gutta

# Please help me with the dynamic calculation to get latest month data available in datasource

Hi All, Please refer below for my scenario:

Below is the my data table:

And i need Out put like below:

I wanted to have a calculation to reflect the view with the latest month where data is available

In future if i get the the data for the different periods for different ID's like below

ID: 1 and Period 1609 sales as 23

ID: 2 and Period 1610 sales as 44

ID: 3 and Period 1611 sales as 72

Then the output for above should be changed to latest values like below:

Basically i need a calculation on period to show latest month data against ID.

Kalyan Gutta.

• ###### 1. Re: Please help me with the dynamic calculation to get latest month data available in datasource

Hi All,

Can any one help me on this? this is very urgent requirement for me.

If having difficulties in understanding please do post the question u have on above scenario so that i can explain more clearly.

• ###### 2. Re: Please help me with the dynamic calculation to get latest month data available in datasource

Hi Check these calculations, I have created 2 calculations like below, i think it is working fine, check it once :

{ FIXED [ID] : MAX(IF NOT ISNULL([Sales]) THEN [Period] END)}  name it z,

IF [z]=[Period] THEN [Sales] END  name it y

and the result field is y , so here idea is to find the most recent month which is having non null value for sales using LOD expression that is what i did in calculation z and then taking sales value only for that month that is in calculation y.

attached the workbook for your reference.

2 of 2 people found this helpful
• ###### 3. Re: Please help me with the dynamic calculation to get latest month data available in datasource

You can try something like this also.

Mahfooj

1 of 1 people found this helpful
• ###### 4. Re: Please help me with the dynamic calculation to get latest month data available in datasource

Hi Kalyan,

After connecting your data through Tableau , select your columns ID, Period and Sales , right click and select Pivot , ( the way i do for the sample data below ). Once you Pivot your Data , you should get what you are looking for , if i understand you correctly.

If this answers your question mark this as answer so that it does not remain opened else provide more details regarding the question.

Thanks

• ###### 5. Re: Please help me with the dynamic calculation to get latest month data available in datasource

Hi Hima vardhan,

Thanks a lot, this helped me and working as expected.

• ###### 6. Re: Please help me with the dynamic calculation to get latest month data available in datasource

Thanks Mahfooj,

This answer is also very helpful, but i could use Hima Vardhan reddy's answer.

Thanks you all for the help