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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RichardJ
Responsive Resident
Responsive Resident

Generating a sub index based on original index value and date values

Hi,

Please see the attached Power BI file 

 

https://www.dropbox.com/s/tyybzdbqz84d8mf/sub-index%20question.pbix?dl=0

 

The sample data shown is in the fileSample DataSample Data

and i'm trying to generate a custom formula (or whatever works best) to generate a sub index using the logic shown


Sample Data Index AddedSample Data Index Added

 

 The logic for incrementing the sub index would be

 

This is where I am trying to add a counter to increment an index for each change in Date.
e.g

row 1 would have 1 in the Sub Index due to it having the earliest date for the index value of 1
row 2 would have 2 in the sub index due to it having the next date for the index value of 1
row 3 would have 3 in the sub index due to it having the next date for the index value of 1
row 4 would have 1 in the sub index value due to it having the first date for the index value of 2)

 

I'd like to be able to count the sequence of each file in the order they were created.

 

Any help appreciated,

Thanks,

Richard

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

Have a look at this example.

 

Few points:

In power query sorted by date column and added a Table.Buffer to ensure the sorting is complete.

bcdobbs_0-1645820125951.png

Then before you expand your existing group add a custom column:

Table.AddIndexColumn([Count], "SubIndex", 1, 1)

bcdobbs_1-1645820172376.png

Expand everything and clean up:

 

bcdobbs_2-1645820240370.png

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

2 REPLIES 2
bcdobbs
Community Champion
Community Champion

Have a look at this example.

 

Few points:

In power query sorted by date column and added a Table.Buffer to ensure the sorting is complete.

bcdobbs_0-1645820125951.png

Then before you expand your existing group add a custom column:

Table.AddIndexColumn([Count], "SubIndex", 1, 1)

bcdobbs_1-1645820172376.png

Expand everything and clean up:

 

bcdobbs_2-1645820240370.png

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
RichardJ
Responsive Resident
Responsive Resident

Thanks very much @bcdobbs for the comprehensive and quick response.

This works perfectly and not an approach I would have thought of. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.