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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Debo1996
Regular Visitor

Use column in an unrelated column to filter through hierarchical data

Hi, 

 

So for context, I have four tables namely:

 

1. Item Table: Contains unique list of items with their parent (stock group)

2. Stock Group Table: Hierarichal table with stock group & its subsequent parent. It also contains a key which says if the stock group is primary (no parent)

3. Scheme Table: Contains schemes that the business run on its items. Schemes are defined on stock groups (not necessarily at the lowest level of hierarchy). This table has no relationship with any other table in the data model.

4. Transaction Table: Contains datewise sales transactions of different items with quantity and amounts.

 

Item Table
Stock ItemStock Group
AAP
BBP
CCP

 

Stock Group Table
Stock Group Stock Group ParentIs Primary?
APAPPN
BPBPPN
CPCPPN
APPAPPPN
BPPBPPPN
CPP Y
APPP Y
BPPP Y

 

Schemes Table
SchemeStock GroupFrom DateTo Date
SCH1CPP01-04-202330-04-2023
SCH1APP01-04-202330-04-2023
SCH2BP01-04-202330-06-2023
SCH3BPPP01-04-202331-08-2023
SCH3APPP01-04-202331-08-2023

 

Transaction Table
DateVoucher No.ItemQtyAmount
02-04-2023V-001A5200
02-04-2023V-001B5300
04-05-2023V-002B10500
04-05-2023V-002C10

500

 

Now I want a measure which will give teh total sales amount for each scheme. Since the level of the stock group in the hierarchy can differ, I am not sure how to code it.

 

I am thinking along the lines of using pathcontains() and path functions but not getting something accurate..

 

Really appreciate the help on this one. Thank you:)

2 REPLIES 2
Debo1996
Regular Visitor

@amitchandak any suggestions on this one?

 

lbendlin
Super User
Super User

Have a look at TREATAS, it allows you to transfer filter context from one table to another even if they are unrelated.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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