7 Replies Latest reply on Jun 6, 2016 11:50 AM by May Shaw

# Calculation in data blending

Hi - I'm new to Tableau...

I'm playing around with the data blending and would like to know what is the best way to do a calculation among multiple data source. For example, I have sales and profit data from sheet 1, IT fee from sheet 2 and Return from sheet 3. It doesn't seem right to just create a calculated field to calculate the net profit (Profit - IT fee - Return).

Any insights on what is the best way to do this? I've attached an example.

Thank you!!

• ###### 1. Re: Calculation in data blending

Hi May,

I don't see anything attached.Can you attach the sample.

Thanks,

Abhay

• ###### 2. Re: Calculation in data blending

Hi May,

Please find the attached screenshot and confirm the output. I have also attached tableau 9.3 version workbook for the same.

SUM([Profit])-Zn(SUM([IT (test)].[IT fee]))-zn(SUM([CB (test)].[Return]))

This one is giving the required output. I hope this helps.

Thanks and Regards,

Ashish Chaudhari

1 of 1 people found this helpful
• ###### 3. Re: Calculation in data blending

Hi May,

Thanks for giving this opportunity. You have created right calculation for Net Profit. Net profit was not calculated reason being it was returning Null value which is why arithmetic calculation failed. I have made changes to it using ZN() which will convert null values to 0. This will not obstruct the arithmetic operation.

Thanks and Regards,

Ashish Chaudhari

1 of 1 people found this helpful
• ###### 4. Re: Calculation in data blending

Hi Ashish,

Thank you so much! This is very helpful.

Just one more question, if I want to link the data quarterly, is using the "datetrunc" the best way to do it?

• ###### 5. Re: Calculation in data blending

Hi Abhay,

I've re-attached the workbook, please find attached.

Thanks!

May

• ###### 6. Re: Calculation in data blending

can you elaborate the scenario in more detail? I mean what you are trying to achieve functionally?

Details will be appreciated. I would love to help you on this.

-Ashish

• ###### 7. Re: Calculation in data blending

Hi Ashish,

For example, my three sheets has different data with different date range and I want to use "Quarter" as the method of linking each sheet. I'm currently using the calculation of datetrunc to change all data to 1/1, 4/1, 7/1 or 10/1. I'm just wondering if there's a better way to do it. As if my sheet 1 only has 1/1, 7/1, 10/1 and sheet 2 has 4/1, 7/1 then the 4/1 data from sheet 2 will not be shown.