Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

How to generate index column by groups

I have an initial table with column t (ref. 1).
I want to expand my table with an index column [i] that goes from 1-4, and at the same time make sure that the table expands as shown in the example (ref. 2) 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Note. I want to do this in Power BI DAX, and not Power Query, because I need to make sure all my sources stay in Direct Query Mode. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    You can create a new calculated table

    Table 2 = var a=GENERATESERIES(1,4,1)
    return GENERATE('Table',a)

    Output

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.