cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Calculating percentage from two different tables in power bi desktop

Hi - I'm an experienced Excel VBA user but new to Power BI.

I have daily sales data from a single outlet/branch in one table and the monthly national sales for the whole company in another table.

eg:

TABLE 1

BRANCH A SALES

2nd Jan 2019     50 sold

5th Jan 2019     46 sold

10th Jan 2019   4 sold

TABLE 2
COMPANY TOTAL SALES
January 2019     1000 sold

The tables both go into February, March, etc.... and will continue into 2020, 2021 etc.

I want to create a column in either of the tables to show the percentage of the BRANCH sales, compared to the companies total sales.... so, for January, as the company sold 1000 of the product, and Branch A sold 100 of the product, somewhere there should be "JANUARY: 10%"

How could I achieve this with DAX or Power Query M please?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: Calculating percentage from two different tables in power bi desktop

Hi @Zepher ,

Sorry to reply you late. Based on my test, you could refer to below stpes:

Sample data:

Use below calculated column:

`Percentae = CALCULATE(SUM(Table1[Sales]),FILTER('Table1',MONTH('Table2'[Company])=MONTH('Table1'[Branch])))/[Sales]`

Now you could see the result:

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 REPLIES 5
Community Support Team

## Re: Calculating percentage from two different tables in power bi desktop

Hi @Zepher ,

I want to create a column in either of the tables to show the percentage of the BRANCH sales

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

## Re: Calculating percentage from two different tables in power bi desktop

Hi @v-danhe-msft Daniel - ultimately, I'd be looking to create a vertical bar graph with January, February, March etc along the bottom, with bars showing the percentage of The Branches sales each month, compared to the whole companies sales for each month.

eg:  In January, the branches sales accounted for 10% of the companies sales, in February, the branches sales were 12% of the companies sales ...and so on.

Frequent Visitor

## Re: Calculating percentage from two different tables in power bi desktop

@v-danhe-msft - Did my extra description help describe the outcome which I'm hoping for?

Frequent Visitor

## Re: Calculating percentage from two different tables in power bi desktop

@v-danhe-msft - Did my extra description help describe the outcome which I'm hoping for?

Community Support Team

## Re: Calculating percentage from two different tables in power bi desktop

Hi @Zepher ,

Sorry to reply you late. Based on my test, you could refer to below stpes:

Sample data:

Use below calculated column:

`Percentae = CALCULATE(SUM(Table1[Sales]),FILTER('Table1',MONTH('Table2'[Company])=MONTH('Table1'[Branch])))/[Sales]`

Now you could see the result: