Forum Discussion
Generate parent id from BOM level information
- 6 years ago
Anonymous
Your DAX formula also seems correct.
JUST REPLACE FIRSTNONBLANK with LASTNONBLANK
Anonymous
Your DAX formula also seems correct.
JUST REPLACE FIRSTNONBLANK with LASTNONBLANK
Zubair_Muhammad Thank you, that DAX suggestion works, but I could not get the Power Query one to work. It only generates null values.
Now I have two working solutions to this:
Parent =
MAXX(
TOPN(
1;
FILTER(
'BOM';
'BOM'[Level] = EARLIER('BOM'[Level]) - 1 &&
'BOM'[Index] < EARLIER('BOM'[Index])
);
'BOM'[Index]; DESC
);
'BOM'[Index]
)and
Parent =
CALCULATE(
LASTNONBLANK(VALUES(BOM[Index]);0);
FILTER(
ALL(BOM);
BOM[Level] = EARLIER(BOM[Level]) - 1 &&
BOM[Index] < EARLIER(BOM[Index])
)
)- Zubair_Muhammad6 years ago
Community Champion
hi Anonymous
I am attaching the pbix file with Power Query Custom formulas
It works with me
- Anonymous6 years agoNot applicable
Thanks, figured it out. You cannot just copy and paste those Power Query formulas because they have some reference to each step done with the data before.
Any ideas on how to generate the PATH directly in Power Query? Or how to generate the Level 1, Level 2, Level ..., Level n automatically? Since I do not know how many levels the data might include.
- Zubair_Muhammad6 years ago
Community Champion
Anonymous
In Power Query, we can use List.Generate to replicate the PATH function.
If you can copy paste some data with expected results, I will try to write it for you