Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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) index.PNG

2 REPLIES 2
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

vxinruzhumsft_0-1682385280218.png

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.

 

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. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors