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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Yug
Advocate I
Advocate I

Create hierarchy table based on columns from table A to create a PnL table

I have a table where my PnL elements are all stored as columns as in below table "Table A". And I would like to create a hierarchy table connected to this table so that I can create a voyage pnl visual. How can I create a hierarchy table that looks like the second table below, "Table B"? 

I createe a hierarchy table by entering data in new table but I cannot connect this to columns in table A to create a pnl dashboard.

Any help would be appreciated. 

Thank you

Yug 

 

Table A:

Voyage noFreightFuel costPort expenseLoad port expDischarge port expenseMisc expenseRevenue Voyage surplusCargo InCargo OutCargo Result
150010100756464400081320010190
270015120342424246291746406
310002435467242411551493674500174
4200010032528656512112583576400176
5800323506414142000127454649056

 

Table B: 

 

Level 1Level 2
Voyage surplusFreight
Voyage surplusFuel cost
Voyage surplusPort expense
Voyage surplusLoad port exp
Voyage surplusDischarge port expense
Voyage surplusMisc expense
Cargo resultCargo In
Cargo resultCargo Out
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Yug ,

 

For this you need to unpivot your data and remove the Voyage and Cargo result values (since they are totals) the final resul will look like this:

MFelix_0-1719247267354.png

Then you can do the relationship and measure to calculate correctly.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @Yug ,

 

For this you need to unpivot your data and remove the Voyage and Cargo result values (since they are totals) the final resul will look like this:

MFelix_0-1719247267354.png

Then you can do the relationship and measure to calculate correctly.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you MFelix for your reply.

My thought was to do somewhat similar -  create another unpovited table. However, since my data table which needs unpivoting is large, (200 columns and many thousand rows and increasing), do yow know if unpivoting will have any impact the performance of the report?

@Yug

 

The impact that yyou may have is on refresh performance but this also depends on the quantity of rows you may be having on your model. 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you very much!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.