Forum Discussion

rmwwgs's avatar
rmwwgs
Frequent Visitor
5 years ago
Solved

Merge 2 queries and duplicate rows from one

I have 2 queries I need to merge, but I need to replicate the rows from one query multiple times.   I am creating a matrix of students grades. At the start of the year they are given a target grade...
  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    5 years ago

    Hi rmwwgs ,

     

    You could create a new table by the following formula:

    newtable =
    VAR _order =
        GENERATESERIES ( 1, 3, 1 )
    VAR _crossjoin =
        CROSSJOIN ( _order, 'Table (2)' )
    RETURN
        UNION ( 'Table', _crossjoin )
    

    The final output is shown below:

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.