Forum Discussion
Merge / Expand two calculated tables into one
- 5 years ago
Matti , Try a new table like
summarize(filter(Table, not(isblank(Table[ParrentKey]))), Table[AccTree],Table[ParrentKey])
- 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])))))
Matti , Try a new table like
summarize(filter(Table, not(isblank(Table[ParrentKey]))), Table[AccTree],Table[ParrentKey])
amitchandak you solved my initial question, thanks!
However, I did not word it quite right or provide a proper example. So let me try again.
So for each AccID, I need to add a row for each unique ParrentActKey within that account tree.
Example data provided below.
| AccID | AccTree | ParrentAccID |
| 1 | 1 | 1 |
| 2 | 1 | |
| 3 | 1 | |
| 4 | 1 | 4 |
| 5 | 1 | |
| 6 | 1 | |
| 7 | 1 | |
| 8 | 2 | 8 |
| 9 | 2 | |
| 10 | 2 | 10 |
| 11 | 2 | |
| 12 | 3 | 12 |
| 13 | 3 | |
| 14 | 3 | |
| 15 | 3 |
Thank you!
- Matti5 years agoFrequent Visitor
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])))))