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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors