topic Hierarchy level delay calculation in App Development
https://community.qlik.com/t5/App-Development/Hierarchy-level-delay-calculation/m-p/1812732#M66334
<P>Hi All, </P><P>Please help in sorting out one logic.</P><P> </P><P>Input data</P><P> </P><TABLE><TBODY><TR><TD>Doc Id</TD><TD>Finished Good</TD><TD>Component</TD><TD>Level</TD><TD>Category</TD><TD>sort Order</TD><TD>Delay</TD></TR><TR><TD>1</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>1</TD><TD>10</TD></TR><TR><TD>1</TD><TD>167</TD><TD>168</TD><TD>1</TD><TD>Child</TD><TD>2</TD><TD>12</TD></TR><TR><TD>1</TD><TD>167</TD><TD>169</TD><TD>1</TD><TD>Child</TD><TD>3</TD><TD>15</TD></TR><TR><TD>1</TD><TD>167</TD><TD>170</TD><TD>2</TD><TD>Child</TD><TD>4</TD><TD>14</TD></TR><TR><TD>1</TD><TD>167</TD><TD>171</TD><TD>2</TD><TD>Child</TD><TD>5</TD><TD>9</TD></TR><TR><TD>1</TD><TD>167</TD><TD>172</TD><TD>1</TD><TD>Child</TD><TD>6</TD><TD>8</TD></TR><TR><TD>1</TD><TD>167</TD><TD>173</TD><TD>2</TD><TD>Child</TD><TD>7</TD><TD>7</TD></TR><TR><TD>1</TD><TD>167</TD><TD>174</TD><TD>2</TD><TD>Child</TD><TD>8</TD><TD>8</TD></TR><TR><TD>2</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>10</TD><TD>3</TD></TR><TR><TD>2</TD><TD>167</TD><TD>190</TD><TD>1</TD><TD>Child</TD><TD>11</TD><TD>4</TD></TR><TR><TD>2</TD><TD>167</TD><TD>191</TD><TD>1</TD><TD>Child</TD><TD>12</TD><TD>7</TD></TR><TR><TD>2</TD><TD>167</TD><TD>192</TD><TD>1</TD><TD>Child</TD><TD>13</TD><TD>9</TD></TR><TR><TD>2</TD><TD>167</TD><TD>193</TD><TD>2</TD><TD>Child</TD><TD>14</TD><TD>2</TD></TR><TR><TD>2</TD><TD>167</TD><TD>194</TD><TD>2</TD><TD>Child</TD><TD>15</TD><TD>4</TD></TR></TBODY></TABLE><P> </P><P>Out Put Data</P><TABLE><TBODY><TR><TD>Doc Id</TD><TD>Finished Good</TD><TD>Component</TD><TD>Level</TD><TD>Category</TD><TD>sort Order</TD><TD>Delay</TD><TD>Level Delay</TD><TD>Total Delay</TD></TR><TR><TD>1</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>1</TD><TD>10</TD><TD>29</TD><TD>39</TD></TR><TR><TD>1</TD><TD>167</TD><TD>168</TD><TD>1</TD><TD>Child</TD><TD>2</TD><TD>12</TD><TD>0</TD><TD>12</TD></TR><TR><TD>1</TD><TD>167</TD><TD>169</TD><TD>1</TD><TD>Child</TD><TD>3</TD><TD>15</TD><TD>14</TD><TD>29</TD></TR><TR><TD>1</TD><TD>167</TD><TD>170</TD><TD>2</TD><TD>Child</TD><TD>4</TD><TD>14</TD><TD>0</TD><TD>14</TD></TR><TR><TD>1</TD><TD>167</TD><TD>171</TD><TD>2</TD><TD>Child</TD><TD>5</TD><TD>9</TD><TD>0</TD><TD>9</TD></TR><TR><TD>1</TD><TD>167</TD><TD>172</TD><TD>1</TD><TD>Child</TD><TD>6</TD><TD>8</TD><TD>8</TD><TD>16</TD></TR><TR><TD>1</TD><TD>167</TD><TD>173</TD><TD>2</TD><TD>Child</TD><TD>7</TD><TD>7</TD><TD>0</TD><TD>7</TD></TR><TR><TD>1</TD><TD>167</TD><TD>174</TD><TD>2</TD><TD>Child</TD><TD>8</TD><TD>8</TD><TD>0</TD><TD>8</TD></TR><TR><TD>2</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>10</TD><TD>3</TD><TD>13</TD><TD>16</TD></TR><TR><TD>2</TD><TD>167</TD><TD>190</TD><TD>1</TD><TD>Child</TD><TD>11</TD><TD>4</TD><TD>0</TD><TD>4</TD></TR><TR><TD>2</TD><TD>167</TD><TD>191</TD><TD>1</TD><TD>Child</TD><TD>12</TD><TD>7</TD><TD>0</TD><TD>7</TD></TR><TR><TD>2</TD><TD>167</TD><TD>192</TD><TD>1</TD><TD>Child</TD><TD>13</TD><TD>9</TD><TD>4</TD><TD>13</TD></TR><TR><TD>2</TD><TD>167</TD><TD>193</TD><TD>2</TD><TD>Child</TD><TD>14</TD><TD>2</TD><TD>0</TD><TD>2</TD></TR><TR><TD>2</TD><TD>167</TD><TD>194</TD><TD>2</TD><TD>Child</TD><TD>15</TD><TD>4</TD><TD>0</TD><TD>4</TD></TR></TBODY></TABLE><P> </P><P>Data Understanding:</P><P>Data is doc id and Finished good wise and sorted based on parent child relation ship.</P><P>if you look on the levels, you can see the parent child relationship.</P><P> </P><P><U><STRONG>we have to start from the lowest level of child for a particular doc id and Finished good combination. So sorting is important</STRONG></U></P><P>Let's check the i/p data.</P><P>for doc id = 1 and finished good = 167, lowest sort order is 8, that means it is the lowest level of child.</P><P>Now start calculating Level Delay, if there is no level below , it means it is 0. and total delay will be Delay + Level Delay.</P><P>This is for child.</P><P>If you move, one level up - you can see level as 2, so it is again child and not parent - so total delay = Delay + Level Delay.</P><P>moving one level up , level is 1. So this is parent for below 2 levels. Now for this, Level delay will be maximum of Total delay from it's child.</P><P>this way, we have to move up in the calculation.</P><P>Any help would be appreciated.</P>Thu, 03 Jun 2021 13:39:53 GMTshiveshsingh2021-06-03T13:39:53ZHierarchy level delay calculation
https://community.qlik.com/t5/App-Development/Hierarchy-level-delay-calculation/m-p/1812732#M66334
<P>Hi All, </P><P>Please help in sorting out one logic.</P><P> </P><P>Input data</P><P> </P><TABLE><TBODY><TR><TD>Doc Id</TD><TD>Finished Good</TD><TD>Component</TD><TD>Level</TD><TD>Category</TD><TD>sort Order</TD><TD>Delay</TD></TR><TR><TD>1</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>1</TD><TD>10</TD></TR><TR><TD>1</TD><TD>167</TD><TD>168</TD><TD>1</TD><TD>Child</TD><TD>2</TD><TD>12</TD></TR><TR><TD>1</TD><TD>167</TD><TD>169</TD><TD>1</TD><TD>Child</TD><TD>3</TD><TD>15</TD></TR><TR><TD>1</TD><TD>167</TD><TD>170</TD><TD>2</TD><TD>Child</TD><TD>4</TD><TD>14</TD></TR><TR><TD>1</TD><TD>167</TD><TD>171</TD><TD>2</TD><TD>Child</TD><TD>5</TD><TD>9</TD></TR><TR><TD>1</TD><TD>167</TD><TD>172</TD><TD>1</TD><TD>Child</TD><TD>6</TD><TD>8</TD></TR><TR><TD>1</TD><TD>167</TD><TD>173</TD><TD>2</TD><TD>Child</TD><TD>7</TD><TD>7</TD></TR><TR><TD>1</TD><TD>167</TD><TD>174</TD><TD>2</TD><TD>Child</TD><TD>8</TD><TD>8</TD></TR><TR><TD>2</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>10</TD><TD>3</TD></TR><TR><TD>2</TD><TD>167</TD><TD>190</TD><TD>1</TD><TD>Child</TD><TD>11</TD><TD>4</TD></TR><TR><TD>2</TD><TD>167</TD><TD>191</TD><TD>1</TD><TD>Child</TD><TD>12</TD><TD>7</TD></TR><TR><TD>2</TD><TD>167</TD><TD>192</TD><TD>1</TD><TD>Child</TD><TD>13</TD><TD>9</TD></TR><TR><TD>2</TD><TD>167</TD><TD>193</TD><TD>2</TD><TD>Child</TD><TD>14</TD><TD>2</TD></TR><TR><TD>2</TD><TD>167</TD><TD>194</TD><TD>2</TD><TD>Child</TD><TD>15</TD><TD>4</TD></TR></TBODY></TABLE><P> </P><P>Out Put Data</P><TABLE><TBODY><TR><TD>Doc Id</TD><TD>Finished Good</TD><TD>Component</TD><TD>Level</TD><TD>Category</TD><TD>sort Order</TD><TD>Delay</TD><TD>Level Delay</TD><TD>Total Delay</TD></TR><TR><TD>1</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>1</TD><TD>10</TD><TD>29</TD><TD>39</TD></TR><TR><TD>1</TD><TD>167</TD><TD>168</TD><TD>1</TD><TD>Child</TD><TD>2</TD><TD>12</TD><TD>0</TD><TD>12</TD></TR><TR><TD>1</TD><TD>167</TD><TD>169</TD><TD>1</TD><TD>Child</TD><TD>3</TD><TD>15</TD><TD>14</TD><TD>29</TD></TR><TR><TD>1</TD><TD>167</TD><TD>170</TD><TD>2</TD><TD>Child</TD><TD>4</TD><TD>14</TD><TD>0</TD><TD>14</TD></TR><TR><TD>1</TD><TD>167</TD><TD>171</TD><TD>2</TD><TD>Child</TD><TD>5</TD><TD>9</TD><TD>0</TD><TD>9</TD></TR><TR><TD>1</TD><TD>167</TD><TD>172</TD><TD>1</TD><TD>Child</TD><TD>6</TD><TD>8</TD><TD>8</TD><TD>16</TD></TR><TR><TD>1</TD><TD>167</TD><TD>173</TD><TD>2</TD><TD>Child</TD><TD>7</TD><TD>7</TD><TD>0</TD><TD>7</TD></TR><TR><TD>1</TD><TD>167</TD><TD>174</TD><TD>2</TD><TD>Child</TD><TD>8</TD><TD>8</TD><TD>0</TD><TD>8</TD></TR><TR><TD>2</TD><TD>167</TD><TD>167</TD><TD>0</TD><TD>Main</TD><TD>10</TD><TD>3</TD><TD>13</TD><TD>16</TD></TR><TR><TD>2</TD><TD>167</TD><TD>190</TD><TD>1</TD><TD>Child</TD><TD>11</TD><TD>4</TD><TD>0</TD><TD>4</TD></TR><TR><TD>2</TD><TD>167</TD><TD>191</TD><TD>1</TD><TD>Child</TD><TD>12</TD><TD>7</TD><TD>0</TD><TD>7</TD></TR><TR><TD>2</TD><TD>167</TD><TD>192</TD><TD>1</TD><TD>Child</TD><TD>13</TD><TD>9</TD><TD>4</TD><TD>13</TD></TR><TR><TD>2</TD><TD>167</TD><TD>193</TD><TD>2</TD><TD>Child</TD><TD>14</TD><TD>2</TD><TD>0</TD><TD>2</TD></TR><TR><TD>2</TD><TD>167</TD><TD>194</TD><TD>2</TD><TD>Child</TD><TD>15</TD><TD>4</TD><TD>0</TD><TD>4</TD></TR></TBODY></TABLE><P> </P><P>Data Understanding:</P><P>Data is doc id and Finished good wise and sorted based on parent child relation ship.</P><P>if you look on the levels, you can see the parent child relationship.</P><P> </P><P><U><STRONG>we have to start from the lowest level of child for a particular doc id and Finished good combination. So sorting is important</STRONG></U></P><P>Let's check the i/p data.</P><P>for doc id = 1 and finished good = 167, lowest sort order is 8, that means it is the lowest level of child.</P><P>Now start calculating Level Delay, if there is no level below , it means it is 0. and total delay will be Delay + Level Delay.</P><P>This is for child.</P><P>If you move, one level up - you can see level as 2, so it is again child and not parent - so total delay = Delay + Level Delay.</P><P>moving one level up , level is 1. So this is parent for below 2 levels. Now for this, Level delay will be maximum of Total delay from it's child.</P><P>this way, we have to move up in the calculation.</P><P>Any help would be appreciated.</P>Thu, 03 Jun 2021 13:39:53 GMThttps://community.qlik.com/t5/App-Development/Hierarchy-level-delay-calculation/m-p/1812732#M66334shiveshsingh2021-06-03T13:39:53ZRe: Hierarchy level delay calculation
https://community.qlik.com/t5/App-Development/Hierarchy-level-delay-calculation/m-p/1812783#M66337
<P><LI-USER uid="46628"></LI-USER> , <LI-USER uid="5533"></LI-USER> - Please help</P>Fri, 04 Jun 2021 05:12:12 GMThttps://community.qlik.com/t5/App-Development/Hierarchy-level-delay-calculation/m-p/1812783#M66337shiveshsingh2021-06-04T05:12:12Z