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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Z_PowerBi
New Member

Help!! Creating a column with the "running" count

Hello everyone, 

 

I was wondering if anyone can help. I have the following column: 

 

Z_PowerBi_0-1680002556145.png

 

And I want to add a further column with an ID but I need the ID to be as follows:

 

Board                                       ID

IGB                                            1

EDC                                          1

SDCB                                        1

SDCB                                         2

IGB                                            2

IGB                                            3

 

Will appreciate any help, thank you

2 REPLIES 2
AlienSx
Super User
Super User

Hello, @Z_PowerBi try this approach

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nR3UorViVZydXEG08Euzk6oDJgKMB0LAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Board = _t]),
    lst = List.Buffer(Source[Board]),
    count = List.Count(lst),
    id_column =  
        List.Generate(
            () => [i = 1, board = lst{0}, value = 1],
            (x) => x[i] <= count,
            (x) => [i = x[i] + 1, board = lst{x[i]}, value = if x[board] <> lst{x[i]} then x[value] else x[value] + 1],
            (x) => {x[board], x[value]}
        ),
    to_tbl = Table.FromRows(id_column, {"Board", "ID"})
in
    to_tbl

 

Anonymous
Not applicable

Assuming that you are trying to form group , please try usng Group option OOTB from Power BI . If you are looking for specific scenario , can you share some relationship on the type of relation you are seeking .

 

 

 

Regards,

Jupsimar Singh.

Mark my post as a solution if it helped you !

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors
Top Kudoed Authors