Forum Discussion
J94
Advocate II
1 year agoMeasure filter certain levels from different columns
Hi all, I have a dataset with products with several components. I want to calculate the number of SKU for each product. Unfortunately, there are double values. The product is a car. So level 0 i...
- 1 year ago
Yes, I see
That's a rather interesting hierarchy - aka a multi parent hierarchy. Not overly surprising since you mentioned a BOM scenario, but still requires special attention. Usually it is done by "cloning" the child.
In your case we need to change the logic to only include items that do NOT appear anywhere earlier in the path.
CleanPath = var l = PATHLENGTH([BillOfMaterials_bk]) var a = ADDCOLUMNS(GENERATESERIES(1,l),"pi",pathitem([BillOfMaterials_bk],[Value])) return CONCATENATEX(filter(a,[pi]<>""),[pi],"|") LastChild = PATHITEMREVERSE([CleanPath],1) LastOccurrences = var c = [LastChild] var a = filter(ALL('Table'),PATHCONTAINS([CleanPath],c) && PATHITEMREVERSE([CleanPath],1)<>c) return if(countrows(a)>0,0,1)
lbendlin
Super User
1 year ago1. Identify the last child for each path
2. Count how many times each of these appear across all paths.
Set a filter to only show the ones that are unique.