How to generate a column based on two columns

Hello,

I have data like below, i need to create row based on two columns data.

Year Min_value Max_value
2004 1 6
2005 3 5
2006 -1 7
2011 -2 671
2016 148 5766

so here i need a column start with "1" for every year upto it reaches to Max_value like below.

Year Min_value MAx_value Rowcount
2004 1 6 1
2004 1 6 2
2004 1 6 3
2004 1 6 4
2004 1 6 5
2004 1 6 6
2005 3 5 1
2005 3 5 2
2005 3 5 3
2005 3 5 4
2005 3 5 5
2006 -1 7 1
2006 -1 7 2
2006 -1 7 3
2006 -1 7 4

Please help me out.

Thanks in advance.

Hi,

I attached a workflow that hopefully does what you were asking for. It uses two nested loops and is therefor probably not the most efficient solution (but I couldn't come up with another).

Best, Martin

If you're worried about  using nested loops, here are three approaches that don't require it. 

- first with an implicit loop inside a java snippet, tidiest looking

- second using one group loop

- third without any loops but potentially costly as it requires a cross-join

Best

David

 

Yet another solution - with just two nodes ;)