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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Excel to Power Bi two axis and grand total help

Hi All,

 

I have the excel below, i want to replicate on Power Bi

 

luisClive_0-1604469288440.png

 

Data Set is below

 

 FY21FY20FY19
 UAEMENationalsUAEMENationalsUAEMENationals
Assurance3915584015412471705
Consulting39846449853981 
Deals82431434511422
TLS6252133134190
Total9228819111317251013127

 

after pivoting and unpivoting for Bi, i managed to get just one axis

I need two axis and grand total

 

LOSME -UAE -NationalsSortHeadcountFY
AssuranceME1155FY21
AssuranceUAE239FY21
AssuranceNationals38FY21
ConsultingME184FY21
ConsultingUAE239FY21
ConsultingNationals36FY21
DealsME124FY21
DealsUAE28FY21
DealsNationals33FY21

 

Power Bi.PNG

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

Here is one way of doing this (I'll attach the sample PBIX file to the reply for you).

First the result:

result.JPG

 

This involves creating a disconnected table to use as the legend including the "total" for each category in the axis.

The process involves:

1) Create a new table using the LOS values and adding a row for "Total" (I created it using the "Enter Data" function in the ribbon):

Legend calc.JPG

2) Create a FY table with unique values by referencing a new query to the source table (to ensure that the periods update automatically) and pivot the columns

FY calc.JPG

3) Append both these tables and unpivot the FY columns. The end result is:

Legend Table.JPG

 

4) Load into the model and do not create a relationship

Model.JPG

 

5) Create the relevant measures:

 

 

Headcount sum = SUM('Table'[Headcount])
TREATAS LOS = CALCULATE([Headcount sum], TREATAS(VALUES('Legend Table'[LOS]), 'Table'[LOS]), TREATAS(VALUES('Legend Table'[FY]), 'Table'[FY]))
Total by LOS = CALCULATE([Headcount sum], TREATAS(VALUES('Legend Table'[FY]), 'Table'[FY]))

 

 

6) Now create the measure you will use in the actual visual:

 

 

Chart measure = IF(SELECTEDVALUE('Legend Table'[LOS]) = "Total", 
                    [Total by LOS], 
                        [TREATAS LOS])

 

 

 

7) and build the visual using the Legend Table field "Legend LOS" as the legend:

Visual.JPG

 

😎 finally format the X-axis to your liking.

 

Attached is the sample PBIX

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

10 REPLIES 10
PaulDBrown
Community Champion
Community Champion

@Anonymous 

It takes time to get out of the "Excel" mindset...!

Let us know if you get stuck anywhere





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

@PaulDBrown 

 

Hi Paul

 

would you be kind enough to recheck this solution, which I use a lot

 

after all the new updates to PBI, once i remove items from Axis, Legend and Values well and then try to add the same back,

i cannot achieve below hierarchy any more

 

Either (ME, national....) or (FY...) shows up on X axis.

Both dont show up together

 

luisClive_1-1614778359213.png

 

 

@Anonymous 

Sorry I am not following you... Can you post an image of what you are getting?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

Here is one way of doing this (I'll attach the sample PBIX file to the reply for you).

First the result:

result.JPG

 

This involves creating a disconnected table to use as the legend including the "total" for each category in the axis.

The process involves:

1) Create a new table using the LOS values and adding a row for "Total" (I created it using the "Enter Data" function in the ribbon):

Legend calc.JPG

2) Create a FY table with unique values by referencing a new query to the source table (to ensure that the periods update automatically) and pivot the columns

FY calc.JPG

3) Append both these tables and unpivot the FY columns. The end result is:

Legend Table.JPG

 

4) Load into the model and do not create a relationship

Model.JPG

 

5) Create the relevant measures:

 

 

Headcount sum = SUM('Table'[Headcount])
TREATAS LOS = CALCULATE([Headcount sum], TREATAS(VALUES('Legend Table'[LOS]), 'Table'[LOS]), TREATAS(VALUES('Legend Table'[FY]), 'Table'[FY]))
Total by LOS = CALCULATE([Headcount sum], TREATAS(VALUES('Legend Table'[FY]), 'Table'[FY]))

 

 

6) Now create the measure you will use in the actual visual:

 

 

Chart measure = IF(SELECTEDVALUE('Legend Table'[LOS]) = "Total", 
                    [Total by LOS], 
                        [TREATAS LOS])

 

 

 

7) and build the visual using the Legend Table field "Legend LOS" as the legend:

Visual.JPG

 

😎 finally format the X-axis to your liking.

 

Attached is the sample PBIX

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

@PaulDBrown 

 

OMG, this is some serious wizardry. Appreciate it a lot.

 

Never though something so simple on excel could be so involving.

 

 

 

Anonymous
Not applicable

@PaulDBrown 

 

Could you guide me?

@Anonymous , FY as Axis and LOS as legend in clustered column visual

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak 

 

Doing exactly that, i got the second BI visual i posted

 

However i want my final solution to be like the excel chart i posted ( first Visual)

amitchandak
Super User
Super User

@Anonymous , Seem like you are looking for Hybrid display, There are a couple of Article on that


https://community.powerbi.com/t5/Community-Blog/Creating-a-custom-or-hybrid-matrix-in-PowerBI/ba-p/1354591
https://community.powerbi.com/t5/Quick-Measures-Gallery/The-New-Hotness-Custom-Matrix-Hierarchy/m-p/963588#M428

vote for Hybrid Table
https://ideas.powerbi.com/ideas/idea/?ideaid=9bc32b23-1eb1-4e74-8b34-349887b37ebc

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

thanks @amitchandak 

 

I was able to achieve matrix table visual im looking for by unpivoting, but I could do a hybrid/two axis chart like excel

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors