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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
OAasPro
Advocate I
Advocate I

Working with complex node path data in both dimension data and fact data

So, in our data source we have a lot of data stored together with a map to determine parent and child hierarchy.

The data is stored in 2 tables:

[Event]
and 

[Map_Events]

[Event] consists of a type ("process", "task" etc.), a unique identification number, a title and other relevant data.
[Map_Events] consists of a parent_id and a child_id.

An event can have more than one parent, and a parent can have multiple children.

What I am trying to achieve, is to create a dashboard where all events of type "Process" can be used as a dimension to filter and aggregate data, and by selecting a specific process I want to filter down all Events related to that process (1 or many levels below) to display facts about the connected events.

Note that a process also could be linked to a parent process etc. so by selecting the top level process, I want to filter to all events connected to that process or any ancestor process linked to the main process no matter how far down they are in the tree structure.
Events could also be linked to each other, so filtering a process should also include events under events under events linked to a process that is an ancestor.

I have tried to illustrate how this node tree could look like:

OAasPro_0-1729505314593.png

 

So the idea here is that any process (marked with green color) should be avaialble as a filter (dimension).
And if I e.g. filter by process P1, I should view all events (marked with blue color).
If I filter by P3, I should see events D-->N
If I filter by P4 I should see events H-->N
If I filter by P6 I should only see events J-->N etc.

Since we have a data mart, I can structure the data before it is made available to Power BI.
Any suggestions on how to structure the dataset as well as a strategy on how to solve this using Power BI Desktop?


3 REPLIES 3
Kedar_Pande
Super User
Super User

Power Query M:

let
Source = Map_Events,
FlattenHierarchy = List.Generate(
() => Source,
each Table.RowCount(_) > 0,
each Table.Join(_, "child_id", Source, "parent_id", JoinKind.LeftOuter),
each Table.SelectColumns(_, {"parent_id", "child_id"})
)
in
FlattenHierarchy

Load the flattened hierarchy table along with the Event table into Power BI.
Ensure there are proper relationships between these tables. Relationships should be set based on id fields.

 

DAX Measure

AllDescendants =
VAR SelectedProcess = SELECTEDVALUE(Event[id])
VAR AllRelated =
CALCULATETABLE(
VALUES(FlattenHierarchy[child_id]),
FILTER(
FlattenHierarchy,
FlattenHierarchy[parent_id] = SelectedProcess ||
FlattenHierarchy[child_id] = SelectedProcess
)
)
RETURN
AllRelated

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

@Kedar_Pande is the Idea here to create a table using dax (AllDescendants) and link this to the table containing all events?

The table with mappingdata is already flattened, it only contains a list of all parent_id child_id combinations.

 

Thanks @Kedar_Pande I will try to implement your suggested solution and give you feedback on how it works out!

 

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.

Top Solution Authors