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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
NadeemAhamed
Helper V
Helper V

Combination of multiple excel file based on columns

Dear Community

 

I have one excel file for Parent company data 

another excel file for child (Subsidiray Company) data

 

i want to mirge and create one dashboard for consolidated report. 

and another dashboard for Subsidiray Company

 

is it possible to mirge the data based on company column in both excel files 

 

Parent Company Data:

NadeemAhamed_2-1720439946973.png

 

Subsidiray Company Data:

NadeemAhamed_1-1720439912196.png

 

Expecting Result: 

Plan values based on Category, Division and Company (Sum of Subsidary Company) 

 
 

NadeemAhamed_7-1720440753787.png

 

Calculated columns and Rows:

* Gross Profit Rate will be (Gross Profit /Sales) 

* Variance will be (Actual-Plan) 

* Achievement will be (Actual/Plan)

 

Thank you in advance 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @NadeemAhamed ,

 

Thanks @DataNinja777  for the quick reply. Please allow me to provide additional insights:

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a table.

Table = 
var _a=FILTER(SELECTCOLUMNS('Parent Company Data',"Company",[Company],"Division",[Division],"Category",[Category]),[Company]="A"&& [Division]="IT")
var _b=DATATABLE ( 
    "Company", STRING, "Division", STRING,"Category",STRING,
    {
        { "A", "IT","Gross Profit Rate" }
    }
)
RETURN UNION(_a,_b)

(3) We can create calculated columns.

Plan = 
var _a=CALCULATE(SUM('Parent Company Data'[Plan]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _b=CALCULATE(SUM('Subsidiray Company Data'[Plan]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _c=CALCULATE(SUM('Subsidiray Company Data'[Plan]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _d=CALCULATE(SUM('Parent Company Data'[Plan]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _e=CALCULATE(SUM('Subsidiray Company Data'[Plan]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _f=CALCULATE(SUM('Parent Company Data'[Plan]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _g=_c+_d
var _h=_e+_f
RETURN IF([Category]="Gross Profit Rate",DIVIDE(_h,_g),_a+_b)
Actual = 
var _a=CALCULATE(SUM('Parent Company Data'[Actual]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _b=CALCULATE(SUM('Subsidiray Company Data'[Actual]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _c=CALCULATE(SUM('Subsidiray Company Data'[Actual]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _d=CALCULATE(SUM('Parent Company Data'[Actual]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _e=CALCULATE(SUM('Subsidiray Company Data'[Actual]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _f=CALCULATE(SUM('Parent Company Data'[Actual]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _g=_c+_d
var _h=_e+_f
RETURN IF([Category]="Gross Profit Rate",DIVIDE(_h,_g),_a+_b)
Variance = [Actual]-[Plan]
Achievement = DIVIDE([Actual],[Plan])

(4) Then the result is as follows.

vtangjiemsft_0-1720603652648.png

Best Regards,

Neeko Tang

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

3 REPLIES 3
Anonymous
Not applicable

Hi @NadeemAhamed ,

 

Thanks @DataNinja777  for the quick reply. Please allow me to provide additional insights:

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a table.

Table = 
var _a=FILTER(SELECTCOLUMNS('Parent Company Data',"Company",[Company],"Division",[Division],"Category",[Category]),[Company]="A"&& [Division]="IT")
var _b=DATATABLE ( 
    "Company", STRING, "Division", STRING,"Category",STRING,
    {
        { "A", "IT","Gross Profit Rate" }
    }
)
RETURN UNION(_a,_b)

(3) We can create calculated columns.

Plan = 
var _a=CALCULATE(SUM('Parent Company Data'[Plan]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _b=CALCULATE(SUM('Subsidiray Company Data'[Plan]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _c=CALCULATE(SUM('Subsidiray Company Data'[Plan]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _d=CALCULATE(SUM('Parent Company Data'[Plan]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _e=CALCULATE(SUM('Subsidiray Company Data'[Plan]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _f=CALCULATE(SUM('Parent Company Data'[Plan]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _g=_c+_d
var _h=_e+_f
RETURN IF([Category]="Gross Profit Rate",DIVIDE(_h,_g),_a+_b)
Actual = 
var _a=CALCULATE(SUM('Parent Company Data'[Actual]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _b=CALCULATE(SUM('Subsidiray Company Data'[Actual]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]=EARLIER('Table'[Category])))
var _c=CALCULATE(SUM('Subsidiray Company Data'[Actual]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _d=CALCULATE(SUM('Parent Company Data'[Actual]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Sales"))
var _e=CALCULATE(SUM('Subsidiray Company Data'[Actual]),FILTER('Subsidiray Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _f=CALCULATE(SUM('Parent Company Data'[Actual]),FILTER('Parent Company Data',[Company]=EARLIER('Table'[Company]) && [Division]=EARLIER('Table'[Division]) && [Category]="Gross Profit"))
var _g=_c+_d
var _h=_e+_f
RETURN IF([Category]="Gross Profit Rate",DIVIDE(_h,_g),_a+_b)
Variance = [Actual]-[Plan]
Achievement = DIVIDE([Actual],[Plan])

(4) Then the result is as follows.

vtangjiemsft_0-1720603652648.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

DataNinja777
Super User
Super User

Hi @NadeemAhamed ,

 

There is no need to combine your parent fact table and your subsidiary fact table in a combined fact tables in Power BI data model.  You can leave them as separate fact tables and create relationship with those fact tables and common dimension tables such as Company, Division, and Category dimension tables.  Also, I would unpivot your Actual and Plan fields so that you would not need to create separate measures for those two scenarios.  I tried to replicate the same result with your example above, but numbers didn't match with yours as I may be missing some information.  Also, it looks like your numbers are unrealistic as gross profit cannot be over 100% 😆.

@DataNinja777 

 

Thank you for understanding and reply

 

Sorry for saying by using the above steps i can't achive result as shown below.

NadeemAhamed_0-1720517525943.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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