2 Replies Latest reply on Jun 21, 2018 12:51 AM by Shinichiro Murakami

# How to calculate part % between two txt reports

Hi guys,

I have 2 txt file, where one report contains date/Product/expected sales data (A)

Other file contains date/ product/Lost sales/root cause (B)

How calculate root cause part %? I marked with yellow.

I have one Power BI formula, but I don’t know, how write in Tableau

BI formula: RC% = sum(lost_sales)/CALCULATE(sum(exp_sales);ALL(lost_sales))

Do you know how to solve it?

• ###### 1. Re: How to calculate part % between two txt reports

Hi Tunde.

You'll need to create a blend between these data sources, after connecting to your first data source, go to the top and select new data source and connect to the second data source:

Ont he top left you should now see two data sources:

Start building out your view, by selecting which data source you want to start with. I started with data source B as it had all the columns I needed - data source B is now my primary data source which is indicated by a blue tick. Now I need to the exp sales from data source A, so I select data source A and bring Exp. Sales to the view.

I then create the below calculation:

Add this to the view and change it into a %:

Then in the analytics pane, I find totals and bring it to the view and drag it over Column Grand Totals:

The you get this final result:

Thanks, please see the attached workbook.

Mavis

• ###### 2. Re: How to calculate part % between two txt reports

Hi Tunde

Here is one simple example. ==> Sheet1

Use Blend.

Use Tale B as primary because it has lower level of granularity. (Root cause)

Add one more data source of Table A and link with Date and Product (Blend)

Or you can use Union + LOD in case you need to show 92.5% in the table together to add up to 100%. ==> Sheet2

Thanks,

Shin