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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
karti1507
Frequent Visitor

Report If data missing for more than 3 concecutive dates

I have the below data, where in I have to report if the data is missing for more than 3 days.  for example City - Jaurez Compaby - BPI Site - JPP data missing after 8/7 for more than 3 days.  Some how I need to flag them! Any help is appreciated!! Thanks. 

karti1507_0-1724860680260.png

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @karti1507 ,

 

I suggest you try this code to create a measure.

Measure = 
VAR _PREVIOUSDATE =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[City] = MAX ( 'Table'[City] )
                && 'Table'[Company] = MAX ( 'Table'[Company] )
                && 'Table'[Site] = MAX ( 'Table'[Site] )
                && 'Table'[Date Provided] < MAX ( 'Table'[Date Provided] )
        ),
        'Table'[Date Provided]
    )
VAR _FUTUREDATE =
    MINX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[City] = MAX ( 'Table'[City] )
                && 'Table'[Company] = MAX ( 'Table'[Company] )
                && 'Table'[Site] = MAX ( 'Table'[Site] )
                && 'Table'[Date Provided] > MAX ( 'Table'[Date Provided] )
        ),
        'Table'[Date Provided]
    )
VAR _DAYDIFF1 =
    DATEDIFF ( _PREVIOUSDATE, MAX ( 'Table'[Date Provided] ), DAY )
VAR _DAYDIFF2 =
    DATEDIFF ( MAX ( 'Table'[Date Provided] ), _FUTUREDATE, DAY )
RETURN
    IF ( _DAYDIFF1 > 3 || _DAYDIFF2 > 3, "Red" )

Then set the conditional formatting for [Date Provided] column.

vrzhoumsft_0-1724897500024.png

Result is as below.

vrzhoumsft_1-1724897577602.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @karti1507 ,

 

I suggest you try this code to create a measure.

Measure = 
VAR _PREVIOUSDATE =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[City] = MAX ( 'Table'[City] )
                && 'Table'[Company] = MAX ( 'Table'[Company] )
                && 'Table'[Site] = MAX ( 'Table'[Site] )
                && 'Table'[Date Provided] < MAX ( 'Table'[Date Provided] )
        ),
        'Table'[Date Provided]
    )
VAR _FUTUREDATE =
    MINX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[City] = MAX ( 'Table'[City] )
                && 'Table'[Company] = MAX ( 'Table'[Company] )
                && 'Table'[Site] = MAX ( 'Table'[Site] )
                && 'Table'[Date Provided] > MAX ( 'Table'[Date Provided] )
        ),
        'Table'[Date Provided]
    )
VAR _DAYDIFF1 =
    DATEDIFF ( _PREVIOUSDATE, MAX ( 'Table'[Date Provided] ), DAY )
VAR _DAYDIFF2 =
    DATEDIFF ( MAX ( 'Table'[Date Provided] ), _FUTUREDATE, DAY )
RETURN
    IF ( _DAYDIFF1 > 3 || _DAYDIFF2 > 3, "Red" )

Then set the conditional formatting for [Date Provided] column.

vrzhoumsft_0-1724897500024.png

Result is as below.

vrzhoumsft_1-1724897577602.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

What if I want to list the dates which are missing 

Result should be 

CityCompanySiteDates Missing
JuarezBPIJPP8/8/2024
JuarezBPIJPP8/9/2024
JuarezBPIJPP8/10/2024
JuarezHopkinsHopkins Manufacturing8/8/2024
JuarezHopkinsHopkins Manufacturing8/9/2024
JuarezHopkinsHopkins Manufacturing8/10/2024
JuarezHopkinsHopkins Manufacturing8/11/2024
JuarezTricoPlanta 18/7/2024
JuarezTricoPlanta 18/8/2024
JuarezTricoPlanta 18/9/2024

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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