Forum Discussion

Matti's avatar
Matti
Frequent Visitor
5 years ago
Solved

Merge / Expand two calculated tables into one

Hi,   Update: Initial question is solved, but didn't fully reflect the case. Additional info provided further down.   I am trying to build a calculated table that merge/expand two calculated tabl...
  • amitchandak's avatar
    5 years ago

    Matti , Try a new table like

    summarize(filter(Table, not(isblank(Table[ParrentKey]))), Table[AccTree],Table[ParrentKey])

  • Matti's avatar
    Matti
    5 years ago

    I managed to solve my problem. Have a look at my solution below.

     

    Turns out GenerateAll was the function I was looking for.

     

    GENERATEALL (

      CALCULATETABLE (
        SELECTCOLUMNS (
          Acc),
          "AccID, Acc[AccID],
          "AccTree", Acc[AccTree])),
      CALCULATETABLE(
        DISTINCT(Acc[ParrentAccKey]),
          FILTER(
            ALL(Acc),
            Acc[AccTree]=[AccTree] && NOT(ISBLANK(Acc[ParrentAccKey])))))