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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Tillyz
New Member

Index column based on values

Hi everyone,

 

I would like to create an index column in power query/dataflow based on different projects. 

Tillyz_1-1684388749831.png

 

But now query only gives me this:

Tillyz_0-1684388710978.png

 

Is that possible to achieve the first table?

 

Appreciate any helps. 

 

Regards,

 

Tilly

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

NewStep=Table.FromRecords(List.Accumulate(Table.ToRecords(PreviousStepName),{{},[]},(x,y)=>let a=Record.FieldOrDefault(x{1},y[Project Name],Record.FieldCount(x{1})+1)+1/100 in {x{0}&{y&[Index=a]},x{1}&Record.AddField([],y[Project Name],a)}){0})

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

NewStep=Table.FromRecords(List.Accumulate(Table.ToRecords(PreviousStepName),{{},[]},(x,y)=>let a=Record.FieldOrDefault(x{1},y[Project Name],Record.FieldCount(x{1})+1)+1/100 in {x{0}&{y&[Index=a]},x{1}&Record.AddField([],y[Project Name],a)}){0})

Thank you very much, it worked and helped me a lot.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors