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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
admin_xlsior
Post Prodigy
Post Prodigy

How to create Organization hierarchy with Direct Query

Hi guys,

 

How to create Organization Hierarchy if I'm using Direct Query. As I know we used to have PATH, PATHLENGTH ,etc but this function is not supported in Direct Query.

 

If lets say I have this kind of data:

CategoryParent categoryParent category code
CORP PROCUREMENT CATEGORIESnullnull
ADVERTISINGCORP PROCUREMENT CATEGORIES44000000
COMMISSIONS AND REBATESCORP PROCUREMENT CATEGORIES44000000
OFFICE AND DESK ACCESSORIESCORP PROCUREMENT CATEGORIES44000000
OFFICE MACHINESCORP PROCUREMENT CATEGORIES44000000
PAYROLLCORP PROCUREMENT CATEGORIES44000000
UTILITIESCORP PROCUREMENT CATEGORIES44000000
VEHICLESCORP PROCUREMENT CATEGORIES44000000
WORKPLACE SERVICESCORP PROCUREMENT CATEGORIES44000000
Calculators or accessoriesOFFICE MACHINES44100000
ComputersOFFICE MACHINES44100000
Printer and facsimile and photocopier suppliesOFFICE MACHINES44100000
TonerOFFICE MACHINES44100000
HighlightersOFFICE AND DESK ACCESSORIES44110000
Pen or pencil setsOFFICE AND DESK ACCESSORIES44110000
ScissorsOFFICE AND DESK ACCESSORIES44110000
Standard envelopesOFFICE AND DESK ACCESSORIES44110000
StaplersOFFICE AND DESK ACCESSORIES44110000
StaplesOFFICE AND DESK ACCESSORIES44110000
CarsVEHICLESVehicles
TractorsVEHICLESVehicles
CleaningWORKPLACE SERVICES 
TrainingWORKPLACE SERVICES 

 

Thanks,

5 REPLIES 5
admin_xlsior
Post Prodigy
Post Prodigy

Hi Li,

 

I believe when you said it is not possible is because it's lack of CategoryCode whereby I have ParentCategoryCode ? Understand this, only I thought we can use the name instead. 

 

However I just add a Category code so I think it will be easier. Like this :

CATEGORYCODECATEGORYNAMEPARENTPRODUCTCATEGORYCODEPARENTPRODUCTCATEGORYNAME
44000000CORP PROCUREMENT CATEGORIESNULLNULL
44100000OFFICE MACHINES44000000CORP PROCUREMENT CATEGORIES
44101501Photocopiers44100000OFFICE MACHINES
44101603Paper shredding machines or accessories44100000OFFICE MACHINES
44101801Calculators or accessories44100000OFFICE MACHINES
44103100Printer and facsimile and photocopier supplies44100000OFFICE MACHINES
44103103Toner44100000OFFICE MACHINES
44110000OFFICE AND DESK ACCESSORIES44000000CORP PROCUREMENT CATEGORIES
44121506Standard envelopes44110000OFFICE AND DESK ACCESSORIES
44121615Staplers44110000OFFICE AND DESK ACCESSORIES
44121618Scissors44110000OFFICE AND DESK ACCESSORIES
44121702Pen or pencil sets44110000OFFICE AND DESK ACCESSORIES
44121716Highlighters44110000OFFICE AND DESK ACCESSORIES
44122107Staples44110000OFFICE AND DESK ACCESSORIES
PAYROLLPAYROLL44000000CORP PROCUREMENT CATEGORIES
ComputersComputers44100000OFFICE MACHINES
VehiclesVEHICLES44000000CORP PROCUREMENT CATEGORIES
CarsCarsVehiclesVEHICLES

 

But the main problem is actually not the column, but I cannot use those DAX function since it is not supported in Direct Query. Or is that any trick so we can still use it ?

 

The visual / outcome however, can be vary. First is of couse the category tree it self. I will put relationship also for that Category code to my item table so it will have the items listed inside of each category.

 

Maybe also I need to separate the leveling, so 1st level - 2nd and 3rd probably will shows its own visual to just display how many item count in that level. 

 

Thanks

Hi @admin_xlsior ,

You can create a measure using Lookupvalue() to achieve your requirement under Direct query mode:

PARENTPRODUCTCATEGORYNAME = 
LOOKUPVALUE (
    'Hierarchy'[Category name],
    'Hierarchy'[Category code], SELECTEDVALUE ( 'Hierarchy'[Parent product category code] )
)

lookupvalue.png

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi,

 

Thanks but how to identify the certain row is Level 1 / 2 / 3 ?

 

Thanks,

Hi @admin_xlsior ,

Since Direct Query mode do not support parent-and-child functions so I'm afraid that currently there is not a good way to certain the row level 1/2/3... . Lookupvalue() is an alternative way to get the output.

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

v-yingjl
Community Support
Community Support

Hi @admin_xlsior ,

As your mentioned, when in DirectQuery mode, it's not possible to use the family of DAX PATH() functions that generally handle Parent-Child structures.

Based on your sample data, what is your expected output? Maybe you can share more details about this issue for further discussion.

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.