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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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