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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

SQL code to insert missing records

Hi,

 

I have a table that looks somthing like below:

allebergh_0-1645187124852.png

And want to insert a new row (yellow below) if a certain record is not repeated in the next period/date. In this example have the account number changed during the year and would need a null value for the period where the change happened in order to calculate a MTD value (source data in YTD values).

 

allebergh_1-1645187136493.png

My table consist of more than 20m records and I would prefer to do this with SQL statement to run the command on the on-prem server instead of in Power Query.

 

Any help/guidance would be much appreciated!

Thanks

Alexander

 

2 REPLIES 2
Anonymous
Not applicable

I would prefer to only have that record created in 2022-08-01 in the above example. However, it would work in my use case if the record was repeated following months, although it would add unneccessary data.

Daryl-Lynch-Bzy
Community Champion
Community Champion

@Anonymous Hi Alex, I was wondering, do you want 2022-09-01 and 2022-10-01 to also show that "3110 | X4P" are 0, or to show only for the 2022-08-01?

Unfortunately, the request to do this in SQL is beyond the scope of this Power BI Power Query forum.  How you achieve this in SQL will depend on the how that environment is configured.  You will need to speak to the DBA or Developers.

 

Many thanks

Daryl

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.