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
Ramh84
Frequent Visitor

Recurrence Problem in Power BI

Good day everyone,

I am facing some techinical difficulities to move from the input table below, to the desired table.

My goal is to print the recurrence of the each Merged item (Merged Header) as of the selected date in the BI report.

For example, 

Ramh84_0-1724936437733.png

If I am selecting a specific date at whcih the Merged item is available e.g., 5-Feb, Marry, A1, 14548, I should have the recurrence

showing 2. In other means the power query should give me the the recurrence of Marry, A1, 14548 since the begining of the year untill the selected date(if such record(Merged header) falls on that day.  

 

The reason that I am having a second merged header that includes the Date is because I am intending to link the recurrence header with another table that will have the same Merged.1 header in there. 
Here you can find the excel sheet 
Test file

 

I will really appreciate your help in solving this buzzle 🙂

 

 

 

Input

 

Ramh84_1-1724937269302.png

 

 

Desired output

 

 

Ramh84_0-1724937245669.png

 

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

You can group by 'Merged', choose 'all rows' and then add an index column starting at one for each nested table. Expand the nested tables with the index column and you will have your result.
Example:

jgeddes_0-1724940232989.pngjgeddes_1-1724940248573.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YGRThikMxLpohQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Column1"}, {{"nestedTables", each _, type table [Column1=nullable text]}}),
    Custom1 = Table.TransformColumns(#"Grouped Rows", {{"nestedTables", each Table.AddIndexColumn(_, "Recurrence", 1, 1, Int64.Type)}}),
    #"Expanded nestedTables" = Table.ExpandTableColumn(Custom1, "nestedTables", {"Recurrence"}, {"Recurrence"})
in
    #"Expanded nestedTables"




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
Ramh84
Frequent Visitor

Really really appreciated your great support!

 

It worked 100%!

All what I needed to do before applying the changes in my actual BI file is to delete the Merged column after creating another one that is a result from merging the merged column with the date to have no duplicate records in the table. 

jgeddes
Super User
Super User

You can group by 'Merged', choose 'all rows' and then add an index column starting at one for each nested table. Expand the nested tables with the index column and you will have your result.
Example:

jgeddes_0-1724940232989.pngjgeddes_1-1724940248573.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclSK1YGRThikMxLpohQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Column1"}, {{"nestedTables", each _, type table [Column1=nullable text]}}),
    Custom1 = Table.TransformColumns(#"Grouped Rows", {{"nestedTables", each Table.AddIndexColumn(_, "Recurrence", 1, 1, Int64.Type)}}),
    #"Expanded nestedTables" = Table.ExpandTableColumn(Custom1, "nestedTables", {"Recurrence"}, {"Recurrence"})
in
    #"Expanded nestedTables"




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.