Forum Discussion
Insert row for missing repeating sequence in a table
I have a time stamp table with a repeating sequence column (90, 91, 92, 93 and repeat), some of the sequences are missing.
I am trying to find the missing value and insert a new row with that value in the column
any help would be appreciated
| 2026-01-05T07:23:00.261 | GSB01 | 93 |
| 2026-01-05T07:23:39.479 | GSB01 | 90 |
| 2026-01-05T07:25:03.896 | GSB01 | 91 |
| 2026-01-05T07:37:14.519 | GSB01 | 92 |
| 2026-01-05T07:40:43.126 | GSB01 | 93 |
| 2026-01-06T09:49:12.376 | GSB01 | 91 |
| 2026-01-06T10:00:01.121 | GSB01 | 92 |
| 2026-01-06T10:02:01.825 | GSB01 | 93 |
| 2026-01-06T10:12:41.143 | GSB01 | 90 |
| 2026-01-06T10:14:41.883 | GSB01 | 91 |
| 2026-01-06T10:26:42.770 | GSB01 | 92 |
I am trying to find the missing mode sequence and insert a row with the missing sequence value
| 2026-01-05T07:23:00.261 | GSB01 | 93 |
| 2026-01-05T07:23:39.479 | GSB01 | 90 |
| 2026-01-05T07:25:03.896 | GSB01 | 91 |
| 2026-01-05T07:37:14.519 | GSB01 | 92 |
| 2026-01-05T07:40:43.126 | GSB01 | 93 |
| 90 | ||
| 2026-01-06T09:49:12.376 | GSB01 | 91 |
| 2026-01-06T10:00:01.121 | GSB01 | 92 |
| 2026-01-06T10:02:01.825 | GSB01 | 93 |
| 2026-01-06T10:12:41.143 | GSB01 | 90 |
| 2026-01-06T10:14:41.883 | GSB01 | 91 |
| 2026-01-06T10:26:42.770 | GSB01 | 92 |
Thanks,
Thanks
Previous solution from AlienSX with List.Generate and calculate next sequence number each time with a help of Number.Mod. worked and is very concise code
3 Replies
- v-nmadadi-msftCommunity Support
Hi karim2026
Thanks for reaching out to the Microsoft Fabric Community forum.
I was able to get the required output using the below DAX, Please try itFinalTable2 = VAR Base = ADDCOLUMNS( 'BaseTable', "NextDateTime", CALCULATE( MIN('BaseTable'[DateTime]), FILTER( ALL('BaseTable'), 'BaseTable'[DateTime] > EARLIER('BaseTable'[DateTime]) && 'BaseTable'[Machine #] = EARLIER('BaseTable'[Machine #]) ) ) ) VAR WithNext = ADDCOLUMNS( Base, "NextSeq", LOOKUPVALUE( 'BaseTable'[Mode Sequence], 'BaseTable'[DateTime], [NextDateTime], 'BaseTable'[Machine #], [Machine #] ), "ExpectedNext", SWITCH( [Mode Sequence], 90, 91, 91, 92, 92, 93, 93, 90 ) ) VAR MissingRows = SELECTCOLUMNS( FILTER( WithNext, NOT ISBLANK([NextSeq]) && [NextSeq] <> [ExpectedNext] ), "DateTime", BLANK(), "Machine#", [Machine #], "Mode Sequence", [ExpectedNext] ) RETURN UNION( SELECTCOLUMNS( 'BaseTable', "DateTime", [DateTime], "Machine#", [Machine #], "Mode Sequence", [Mode Sequence] ), MissingRows )
Uploading the .pbix file for reference as well.I hope this information helps. Please do let us know if you have any further queries.
Thank you
- karim2026Regular Visitor
Thanks
Previous solution from AlienSX with List.Generate and calculate next sequence number each time with a help of Number.Mod. worked and is very concise code
- v-nmadadi-msftCommunity Support
Hi karim2026 ,
We really appreciate your efforts and for letting us know the update on the issue.
Please continue using fabric community forum for your further assistance.
Regards