Replicate PATH() DAX function in Dataiku
riri92
Registered Posts: 1 ✭
Hello everyone,
I want to replicate the path() dax function using visual recipes in Dataiku.
For example, I have this source table :
ID | Parent_ID |
A | B |
B | G |
C | A |
D | C |
E | F |
F | A |
G | B |
I want to create a new Path column that returns a delimited text string with the identifiers of all the parents of the current identifier, starting with the oldest and continuing until current :
ID | Parent_ID | Path |
A | B | H|G|B|A |
B | G | H|G|B |
C | A | H|G|B|A|C |
D | C | H|G|B|A|C|D |
E | F | H|G|B|A|F|E |
F | A | H|G|B|A|F |
G | H | H|G |
I tried to use a python recipe but I apparently have a memory problem. I don't know if it can be achieved through visual recipes and formulas.
Thank you for the help.
Answers
-
JordanB Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 296 Dataiker
Hi @riri92
,Unfortunately, there isn't a built-in function in visual recipes that would achieve this. I would recommend going the Python route to generate an equivalent output. You could leverage the Dataiku Python API and libraries such as Pandas to read in the dataset, compute the path hierarchy and append the output of the parent-child relationship as a new column to the dataset.To reduce the memory overhead, you could try breaking up your data or break the work into batches. As a last resort, you could increase the "jek.xmx" setting to 3g, according to this procedure: https://doc.dataiku.com/dss/latest/operations/memory.html#the-jekLet me know if you have any further questions.Thanks!Jordan