Forum Discussion

newhopepdx's avatar
newhopepdx
Resolver I
1 year ago
Solved

Table Transformation

Accounts in a piece of software we use can be created in a parent child scheme and visually represented (on the page we make a selection from and add to the list) like the second image below. The res...
  • BA_Pete's avatar
    BA_Pete
    1 year ago

     

    Ah, ok. So you're essentially trying to build a dimension(ish) table.

    In that case, you can add level columns like this:

     

    Level_1 = 
    VAR __path = PATH(Table1[AccountId], Table1[ParentAccountId])
    RETURN
    CALCULATE(
        MAX(Table1[Name]),
        FILTER(
            Table1,
            Table1[AccountId] = VALUE(PATHITEM(__path, 1))
        )
    )

     

    Unfortunately you'll need to create one for each level of your hierarchy, but I think it does what you're after.

     

    Output:

     

    Pete