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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
gary_beswick
New Member

how to find missing numbers in an otherwise sequential list

if these are values in a field called ID:   1,2,3,4,5,6,8,9,10,11,12,13,14,16.......

 

How do i develop a way to automatically identify the fact that 7 and 15 are missing

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Depending on the goals it can be done in DAX and Power Query.

 

Here's the PQ version:

  • Load the data into PQ
  • Find the min and the max of that data
  • use that min and max to generate all the values between those two 
  • This is your "Full Table"
  • Generate List.png
  • Duplicate the original query
    • Merge with the full query
    • From Original to Full Table
    • Right Outer
  • Expand the the table
  • You will see Null in the original table column, and what that value is in the new column
  • Tables after merge.png
  • can filter on the null to see what values are missing
  • whats missing.png

 

In DAX I believe you would use GENERATESERIES and pretty much do the exact thing. 

 

PBIX File is here:

https://1drv.ms/f/s!AoQIGRpzoxRHgbxT1CxyVGNGYUXqgQ

View solution in original post

2 REPLIES 2
atlas_nordman
Regular Visitor

Thank you for the elegant solution. However, I went crazy before realizing I had to sort the merged table "Ascending" after the "Full sequence" column.  

Anonymous
Not applicable

Depending on the goals it can be done in DAX and Power Query.

 

Here's the PQ version:

  • Load the data into PQ
  • Find the min and the max of that data
  • use that min and max to generate all the values between those two 
  • This is your "Full Table"
  • Generate List.png
  • Duplicate the original query
    • Merge with the full query
    • From Original to Full Table
    • Right Outer
  • Expand the the table
  • You will see Null in the original table column, and what that value is in the new column
  • Tables after merge.png
  • can filter on the null to see what values are missing
  • whats missing.png

 

In DAX I believe you would use GENERATESERIES and pretty much do the exact thing. 

 

PBIX File is here:

https://1drv.ms/f/s!AoQIGRpzoxRHgbxT1CxyVGNGYUXqgQ

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.