Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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

Hi @Anonymous ,

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

Sample data:

1.PNG3.PNG

Use below calculated column:

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

Now you could see the result:

2.PNG

You could aslo download the pbix file to have a view.

 

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.

View solution in original post

5 REPLIES 5
v-danhe-msft
Employee
Employee

Hi @Anonymous ,

I could not clear with your desired result about:

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

Could you please post your desired result if possible?

 

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.
Anonymous
Not applicable

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

 

Anonymous
Not applicable

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

Hi @Anonymous ,

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

Sample data:

1.PNG3.PNG

Use below calculated column:

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

Now you could see the result:

2.PNG

You could aslo download the pbix file to have a view.

 

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.
Anonymous
Not applicable

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. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.