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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Matrix with multiple hierarchy

Hello,

 

I have a table that contains father_code and for each one of them there is a son code(it's like category and subcategory).

In parallel with, i have a corresponding label that corresponds to heach category. (It's like having Cateogry and subcategory and with it color and subcolor).

 

Note: The son code here is the first element as there is no father code for it.

 

Here is my table: 

Son_codeFather_codeLabel
A 1
BA3
HA2
EA4
FA5
CB6
DB7

 

I tried using matrix to visualize the data but it does not work with double hiearchies as the first son code is not the real son code but the father code.

 

Here is a formatted table to understand the problem and how the output should show: 

 CODELABEL
+A1
-A|H1|2
-A|B1|3
-A|F1|5
-A|E1|4
-A|B|C1 | 3 | 6
-A|B|D1|3 | 7

 

If you have any idea on that either matrix or using DAX to format that.

 

Thank you in advance,

Salem

2 ACCEPTED SOLUTIONS
Wilson_
Super User
Super User

Hey salemhaddad,

 

Look into the PATH DAX function. Here's a link to some documentation. It seems to be exactly what you need.


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




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

Proud to be a Super User!





View solution in original post

Anonymous
Not applicable

4 REPLIES 4
Anonymous
Not applicable

It works by putting it as column and not a measure.

https://community.fabric.microsoft.com/t5/Desktop/PATH-DAX-Measure-A-table-of-multiple-values-was-su...

Thank you very much.

You're welcome!




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

Proud to be a Super User!





Anonymous
Not applicable

Thank you very much for the recommandation.

 

I tried to use it: 

DEFINE
  VAR path_column = PATH(table[Son_code], table[Father_code])
 
  EVALUATE
    SELECTCOLUMNS(table,table[Son_code], table[Father_code], 
"path_column", path_column
)
 
It give an error: A table of multiple values was supplied where a single value was expected.
Wilson_
Super User
Super User

Hey salemhaddad,

 

Look into the PATH DAX function. Here's a link to some documentation. It seems to be exactly what you need.


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




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

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors