Forum Discussion

satishorre20's avatar
satishorre20
Helper II
1 year ago
Solved

Create Hierarchy column using Path function on persons data

Good morning,   I am trying to create a column using "path" dax function on id and supervisor id on “Persons data” and persons data is Type -2 Dimension table. id will be natural key and may have m...
  • V-yubandi-msft's avatar
    1 year ago

    Hi satishorre20 ,

    This issue often occurs when a date filter such as  2025-04-15 is applied. Instead of returning only the records valid on that date, the model processes the entire history, which can result in multiple supervisor IDs per person and disrupt the expected behavior of visuals or hierarchy logic.

    To address this, I revised the logic as follows

    1. The table is initially filtered to include only the rows valid for the selected date (where [Start Date] <= selected date <= [End Date])
    2. This approach ensures that each ID has only one active supervisor in the current context
    3. The PATH() function is executed after scoping the data, resulting in accurate and clean hierarchies
    4. Because the process is controlled by the slicer, it updates automatically with any date change

    This results in a dynamic model that accurately reflects the reporting date, eliminates ambiguity, and ensures that visuals such as matrices or trees function correctly, without the need for flattening or static solutions.

     

     

    The PBIX file is attached for your reference. Please let me know if you need any adjustments in the future.

     

    Regards,

    Yugandhar.