inheriting
1 TopicInherit Values from previous rows
Dear Community, I am facing an issue regarding an inheriting logic. I have a table in my canvas environment (example attached with the key columns), which contains certain subcategories. Those are having an descending index, which will start new for every subcategory. Additionally, I have one value column, which includes for every first row of an subcategory (highest index) an 0 or 1 value. With the calculation I want to fill in a new column for every row in the respective subcategory this "first row value". One special case is, that in the column inherit flag the indentificator "MSCOP" can occur, which turns over the inherting value, as it was previously 0 then its now 1 and the other way round. Summarization: I want to have an inheriting logic of values (0 or 1), which is firstly just inheriting the value from the previous row. When the indetificators "First row" or "MSCOP" occur, a re-evalution of the to-inherit value should happen. I tried with some code attached below, but wasnt successfull so far. Thank you very much VAR CurrentSubcategory = MyTable[Subcategory] VAR CurrentValue = MyTable[First Row Value] VAR InheritFlag = MyTable[Inherit_Flag] VAR CurrentRow = MyTable[Index.1] VAR InheritedValue = CALCULATE( MAXX( FILTER( ALL(MyTable), MyTable[Subcategory]] = CurrentSubcategory && MyTable[First Row Value] <> BLANK() && MyTable[Index.1] < CurrentRow ), MyTable[First Row Value] ), ALLEXCEPT(MyTablet, MyTable[Subcategory]]) ) VAR NewSubcategory = NOT ( MyTable[Subcategory]] = CALCULATE( VALUES(MyTable[Subcategory]]), MyTable[Index.1] = CurrentRow ) ) RETURN IF( OR( ISBLANK(CurrentValue), InheritFlag = "MSCOP" ) || NewSubcategory, InheritedValue + IF(InheritFlag = "MSCOP", -1, 0), BLANK() ) Subcategory column Index.1 First Row value Inherit_Flag Wished Result Subkategory 1 5 0 First Row 0 Subkategory 1 4 0 Subkategory 1 3 MSCOP 1 Subkategory 1 2 1 Subkategory 1 1 1 Subkategory 2 5 1 First Row 1 Subkategory 2 4 1 Subkategory 2 3 1 Subkategory 2 2 1 Subkategory 2 1 1 Subkategory 3 5 0 First Row 0 Subkategory 3 4 0 Subkategory 3 3 MSCOP 1 Subkategory 3 2 1 Subkategory 3 1 1Solved1.3KViews0likes5Comments